Re: Re: Generators in PHP

From: Date: Tue, 24 Jul 2012 17:56:46 +0000
Subject: Re: Re: Generators in PHP
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
2012/7/24 Andrew Faulds <[email protected]>:
> Much easier to make an iterator with a function than as a class.

2012/7/24 Yahav Gindi Bar <[email protected]>:
> 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?

-- 
Alex Aulbach


Thread (142 messages)

« previous php.internals (#61712) next »