Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104728 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 58001 invoked from network); 15 Mar 2019 00:58:07 -0000 Received: from unknown (HELO lb3-smtp-cloud8.xs4all.net) (194.109.24.29) by pb1.pair.com with SMTP; 15 Mar 2019 00:58:07 -0000 Received: from [IPv6:2001:983:6fc5:1:ad39:bffb:a496:ca64] ([IPv6:2001:983:6fc5:1:ad39:bffb:a496:ca64]) by smtp-cloud8.xs4all.net with ESMTPA id 4YDJhyFCo4HFn4YDKhX24N; Thu, 14 Mar 2019 22:48:35 +0100 To: internals@lists.php.net References: <6d3be21f-d63a-3fc6-94ee-0bde8e313d66@xs4all.nl> Message-ID: Date: Thu, 14 Mar 2019 22:48:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: nl Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfBNxc9JDCCWCNgMt2aWWGmopzCrFjcYMXi142vWJ2NgRam9Wo5EOqNbNHiGEg92spmvvL1q4zGWJVSEgwgbePK8a/TJhtAJIVA68gqrI7jVG9IXXnDxC JLDmhs/wkuWbnwr9DfMMZiCejui8/fAhzAT/YWJu739bjk7OkGjsgwjY9j5Rp8HIBnyktLwUWS0xIt/vykmWvorh4nnLvpmNJFQvOh0VOktu9qXdy+Zwp6UC uLcas+lPj7jpp2V22Uan0p8bHFW5BvoGYf2GZfpULIE= Subject: Re: [PHP-DEV] RFC Draft: Comprehensions From: d.takken@xs4all.nl (Dik Takken) 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