On 24 ביול 2012, at 20:35, Andrew Faulds wrote: > On 24/07/12 18:34, Alex Aulbach wrote: >> 2012/7/23 Sara Golemon <poll...@php.net>: >>> Curious if you could expand on that. Generators are iterators, so not sure >>> what you're asking for. >> It's the point which is unlogical for me. Maybe it's a question. If >> the generator is an object with the implementation of an iterator, why >> do we need to have it as _function_? >> > Much easier to make an iterator with a function than as a class. > > -- > Andrew Faulds > http://ajf.me/ > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
I agree, implementing a class only for iterator may be pain sometimes, and functions is much better - especially when 5.3 got the anonymous functions, so we can even use the generators for iterator functions in class methods which can be great. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php