Hi Den søn. 10. mar. 2019 kl. 23.45 skrev Larry Garfield <la...@garfieldtech.com>: > > Hello, peoples. I know it's been discussed once or twice before on the list, > many years ago, but not recently. I therefore feel OK putting forth the > following draft proposal for Comprehensions, aka "compact generators", in PHP: > > https://wiki.php.net/rfc/comprehensions
While I think believe the RFC has great intentions, I am not a fan by any means to introduce convoluted syntaxes like this into PHP, I think it is rather hard to read vs the gain of saving a few key strokes. I think that both the shorthand closures and this makes PHP code potentially even harder to read and I would prefer we did not add such essential sugar where you need to understand the semantics very well to understand what a piece of foreign code may do, in what order (like the no yield example given). One more thing that kinda "annoys" me / what I base my above statement on is; when reading some of the example is that the code examples given, as in the code inside a Comprehension does not look very PHP-ish besides the $-sigil and I do not like the idea of having "two" syntaxes for PHP where one is only available in a very narrow-, specific context and I feel it would be prone to potential errors. Another thing that has been mentioned by multiple people now is the for-vs-foreach; If it is a foreach, which you mention in the RFC then it should be so, not for. A little background on where I am coming from here; I think it is great that we look at other languages and technologies when designing PHP and adding more features the language, however while I do believe it is an important point to keep cross language consistency, I do think that consistency with PHP itself is more important, which I believe too, is the reason for the expression for using foreach in this context comes from (not only from my PoV). -- regards, Kalle Sommer Nielsen ka...@php.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php