Re: RFC Draft: Comprehensions

From: Date: Tue, 12 Mar 2019 14:12:43 +0000
Subject: Re: RFC Draft: Comprehensions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-104675@lists.php.net to get a copy of this message
Hi Den tir. 12. mar. 2019 kl. 15.49 skrev Chase Peeler <chasepeeler@gmail.com>: > Everything looks weird and "non-phpish" when it's new. OO constructs > weren't PHP-ish at first, because PHP didn't originally support OO. Imagine > "foreach" didn't exist in PHP and we were still using while(list($key,$value) = > each($arr)) syntax. > > I agree that some of the examples are a bit hard to read and understand - but that's only > because we haven't been exposed to them. What I mean here is that the lack of things like the parentheses makes the code generally harder to read, imagine this for large comprehensions as userland would certainly do things like that and you end up with monstrosities of code that is less verbose than the counter examples given in the RFC. I mean sure I could just rewrite a comprehension with a lot of whitespace, but it kinda seem to defeat the purpose of short circuited generators and I might as well just write it the more verbose way. I like the idea, just not the syntax because it has the potential (along with short closures) to be annoying to read in the long run. -- regards, Kalle Sommer Nielsen kalle@php.net

« previous php.internals (#104675) next »