On 24/07/12 18:56, Alex Aulbach wrote:
2012/7/24 Andrew Faulds <a...@ajf.me>:
Much easier to make an iterator with a function than as a class.
2012/7/24 Yahav Gindi Bar <g.b.ya...@gmail.com>:
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.
Ok, why not call it "iterator" or "generator" or "huffpuff" instead of
"function"? It's just the naming, which disturbs me, because a
function is something which is, when called once finished once. I
don't like mathematics, but that is one of the definition of a
function:
http://en.wikipedia.org/wiki/Function_%28mathematics%29
"each input is related to exactly one output"
Couldn't be so complicated to introduce a new name for that, or?
You'll love LISP, I'm sure, or maybe Python's functional subset.
But PHP functions usually have side-effects, they aren't strict
mathematical functions.
So complaining about this is rather pointless.
--
Andrew Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php