Re: RFC Draft: Comprehensions
| From: | Wes | Date: | Sun, 10 Mar 2019 22:41:46 +0000 |
| Subject: | Re: RFC Draft: Comprehensions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104640@lists.php.net to get a copy of this message | ||
Hi!
proposed syntax:
> $gen = [for $list as $x if $x % 2 yield $x*2];
>
current php + short closures:
$gen = () => foreach($list as $x) if($x % 2) yield $x * 2;
1- parentheses could be optional around control structures, so
if(true){}
could be simply if true{}
2- "for" could accept the syntax of "foreach"
3- we need short closures