Re: [RFC] Generators

From: Date: Mon, 20 Aug 2012 11:56:08 +0000
Subject: Re: [RFC] Generators
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-62281@lists.php.net to get a copy of this message
On 20/08/12 02:01, Rasmus Lerdorf wrote: > I would still like to understand what this generator keyword would > actually do. I don't see how it would work. Would a function marked > generator somehow not be allowed to return normally or to finish and not > return anything? How could this be enforced? I am completely against any > keyword that is essentially documentation-only. > > -Rasmus Given that such function could "return several times", seems a different enough function type to have its keyword. You could not decorate it and rely instead on the presence of the yield keyword, but parsers will thank knowing about it from the start rather than realising at mid-parsing that the function is a completely different beast. Regards

« previous php.internals (#62281) next »