2012/7/25 Nikita Popov nikita.ppv@gmail.com:
particular with namespaced code). So if you have some kind of
Code\Generator class, you're screwed.
Keywords don't grow on trees, you know ;)Hm. Ok, thats a problem.
Oh, man, do I really have to find a good keyword myself? Maybe we
should use a password-generator. :)
Seriously, how's aboutyielder hugo() { ... yield ...}
Feels right, but my native language is not english, so I risk to make
me a fool. I think that also names what it really is: A yielder yields
something. In this case: An iterator yielder yields an iteration. I
think I would like that.
And the word is per sure not common. :)
Ahmm, if you don't like it, would you be so kind to make a suggestion? TNXAlso I'd like to point out that being similar to other languages is in
the general case a good thing. So if you say "It doesn't matter howIn general I agree. For PHP I do not. This case is a little bit
different, because the targets are self-explaining and simplicity.Deviating from the
"standard" generator implementation without having good reasons seems
rather pointless to me.But I gave good other reasons. :)
Conclusion:
Fact: generator is not a good keyword, because too common.
Answer: I made a new sugestion with the keyword "yielder".
Fact: in general it's a good idea to implement features, like in other
languages.A: Correct, but
Fact: PHP has different architectural targets which doesn't mean to
make everything different, but ...
Experience: in this case I'm sure, it's not the best way to make it
like any other language.
Experience: If you have enough reasons to make things different, don't
look too much how others are doing.
Experience: Most PHP-programmers are not so experienced like most
programmers in other languages.
(Can't be proven, but I would bet for it.)--
Alex Aulbach--
Wow, I wasn't near my computer for the last day and I see that the conversation really grew ;)
"yielder" sounds quite weird don't you think (but my native language is not English too.. so don't blame me at english stupid conclusions!)
Fact: generator is not a good keyword, because too common.
I can't see the connection... people relate the generator keyword to the iterators so what's the problem using it?
what about using the "iterator" name as generators keyword? because it does return iterators...
iterator foo() { ... yield $bar; ... } sounds OK for me... and got a meaning too.
though it can confuse some people with the original iterators...
BTW: I still don't think that the generators need a unique word and I suggest using functions, but I didn't read al the mails chain, so I assume that I'll find there the answer.