Re: Re: Generators in PHP

From: Date: Wed, 25 Jul 2012 22:22:12 +0000
Subject: Re: Re: Generators in PHP
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-61795@lists.php.net to get a copy of this message
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 about yielder 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? TNX > Also 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 how In 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

« previous php.internals (#61795) next »