Re: Re: Generators in PHP
| From: | Rasmus Lerdorf | Date: | Wed, 25 Jul 2012 23:49:18 +0000 |
| Subject: | Re: Re: Generators in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61798@lists.php.net to get a copy of this message | ||
On 07/25/2012 04:25 PM, Alex Aulbach wrote:
> In 50 lines of code yield will be just overseen.
>
> But I meant something different: I thought of documentation. Maybe
> someone reads the docs. Really! In the docs he will find functions.
> And in the function this "yield". He dosn't want to know that. It
> makes stress. "Why do I need to know how yield functions work, I
> barely understand functions."
> So this is systematically wrong. Right would be, that yield is an own
> chapter. Will be easier if a generator is not a function.
I'm with Sara on this one. A generator is enough like a function that we
don't need a new keyword for it. We typically don't get too pedantic in
PHP concepts and try to keep things simple. What we call an array isn't
technically an array either. It's an ordered map, but it looks enough
like an array that it is simpler to just call it that.
And objects technically have methods or member functions, not functions,
but we don't have a method/member keyword either.
-Rasmus