On Thu, Jun 7, 2012 at 10:46 AM, Gustavo Lopes <glo...@nebm.ist.utl.pt> wrote: > I mean how do you deal with "return $foo" in the body of the generator? Does > it work like a final yield? Is the return value ignored? Currently there will be a fatal error if return statements (with values) are used in the generator. In the future I'd like to use the return value as the result of a yield from / yield* expression, as it is currently done in Python and JavaScript. This is particularly useful if you are delegating control to another coroutine. This way you can for example break down a coroutine-based parser into several functions (instead of having one big ugly function).
> Are you planning on any internal API for functions to implement generators > (though I really haven't thought how that would work)? I don't think that this is possible. Generators require that the execution context is suspended in some way and we have to that control only over userland code, not internal C code. Nikita -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php