Re: RFC Draft: Comprehensions

From: Date: Wed, 13 Mar 2019 22:30:40 +0000
Subject: Re: RFC Draft: Comprehensions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-104703@lists.php.net to get a copy of this message
On 13/03/2019 21:10, Dik Takken wrote:
So in practice, I expect that using comprehensions as proposed in the new RFC will also require doing a lot of iterator_to_array(). A dual comprehension syntax could fix that.
At risk of complicating things further, might the solution to that be to have a shorter syntax for iterator_to_array in general? It's a shame array-casts are defined for arbitrary objects, else we could have (array)$iterator - and therefore (array)[foreach ($users as $user) yield $user->firstName] Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#104703) next »