Re: RFC Draft: Comprehensions

From: Date: Thu, 14 Mar 2019 21:48:33 +0000
Subject: Re: RFC Draft: Comprehensions
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-104728@lists.php.net to get a copy of this message
On 13-03-19 23:30, Rowan Collins wrote: > 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] A shorter alternative for iterator_to_array() could work as well I think. Casting would have been stellar, but not feasible. However, could using the array() built-in work? Something like: array([foreach ($users as $user) yield $user->firstName]) Just thinking out loud here... Regards, Dik Takken

« previous php.internals (#104728) next »