>
> Again: I don't have any problems with the object returning. :)
>
> I see a problem that the mechanism isn't understood and used wrong.
>
Isn't understood by who? Used wrong by who? Are we talking about
people using a feature, that doesn't exist yet in PHP, the wrong way
and arguing that there is an apparent lack of understanding of this
non-existent features among the user-base? I'm sorry, I really don't
follow this train of thought.
> And I think, that it is too easy to oversee that it is not a "normal"
> PHP-function, because the "yield" is normaly in the middle of the code
> and "return" at the end.
>
The only thing that's not normal here is the flow of control being
passed back and forth between the generator and the function
> Both couldn't be changed. But it could help, if you name different
> things different.
What do you want to name it? If it's a function definition it clearly
should be called a function in order to remain inline with the
existing PHP code out there. Otherwise you're adding more confusion.
The fact that the function contains a "yield" shouldn't change the
fact that it's still a function. I agree it behaves differently, but
the same could be argued about functions that call other functions or
even functions that call themselves. The flow of control there isn't
always obvious from static code analysis, but that's what the runtime
environment is there to aid the developer with. How is changing the
name going to aid the developer's understanding of generators any
better? I doubt this adds any real value here aside from pointing out
the already obvious "this function contains a yield".
>
> ... I have no problem
> with it, I use PHP every day, but as explained most PHP-developers
> will have problems and I can say that, because I've more than 20 years
> experience in that. Do you have that?
>
20 years experience in PHP? No, I believe it only ever appeared
publicly about 17 years ago.
20 years experience with developers that have problems? Yes, there's
no shortage of them.