Re: Generators in PHP

From: Date: Wed, 06 Jun 2012 02:42:44 +0000
Subject: Re: Generators in PHP
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-60749@lists.php.net to get a copy of this message
On Wed, Jun 6, 2012 at 10:27 AM, Laruence <laruence@php.net> wrote: > On Wed, Jun 6, 2012 at 10:15 AM, Laruence <laruence@php.net> wrote: >> Hi Nikita: >> >>    the most important part to me is how did you implemented >> yield >> keyword,   is there a whole patch file I can look into? > Nervermind,  I will check the branch out later > > thanks After a quick look, I think the main idea should goes to two parts: 1. implement yield (Zend) 2. implement spl_generators but not generator class (Spl) then we can implement spl_coroutine later base on this. what do you think? thanks >> >>    what will happen if you use a yield in a normal >> function? >> >>    actually,  I tried to implemented coroutine, but since I could not >> find a way to make zend_execute interruptable, then I didn't make it. >> >>    so, I am really interesting of this tech-specific :) >> >> thanks >> >> On Wed, Jun 6, 2012 at 1:35 AM, Nikita Popov <nikita.ppv@googlemail.com> wrote: >>> Hi internals! >>> >>> In the last few days I've created a proof of concept implementation >>> for generators in PHP. It's not yet complete, but the basic >>> functionality is there: >>> >>> https://github.com/nikic/php-src/tree/addGeneratorsSupport >>> >>> The implementation is outlined in the RFC-stub here: >>> https://wiki.php.net/rfc/generators >>> >>> Before going any further I'd like to get some comments about what you >>> think of adding generator support to PHP. >>> >>> If you don't know what generators are you should have a look at the >>> "Introduction" section in the above RFC or in the Python documentation >>> at http://wiki.python.org/moin/Generators. >>> >>> Nikita >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> >> >> >> -- >> Laruence  Xinchen Hui >> http://www.laruence.com/ > > > > -- > Laruence  Xinchen Hui > http://www.laruence.com/ -- Laruence  Xinchen Hui http://www.laruence.com/

« previous php.internals (#60749) next »