Re: RFC - Array slice syntactic sugar
| From: | John Bafford | Date: | Fri, 20 Mar 2015 21:44:10 +0000 |
| Subject: | Re: RFC - Array slice syntactic sugar | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85340@lists.php.net to get a copy of this message | ||
On Mar 20, 2015, at 17:27, Stanislav Malyshev <smalyshev@gmail.com> wrote:
> Hi!
>
>> I provided an array_key_first() implementation awhile ago that was
>> first shot down because “too many array_* functions”, and then later
>> ignored because I didn’t want to go through the RFC process just to
>> add a few functions. (PR here:
>> https://github.com/php/php-src/pull/347)
>
> Adding array functions definitely requires and RFC process, arrays are
> primary data structure in PHP that stores practically everything, so
> having good API for them is essential. It's not that hard to make an
> RFC, and given that you propose a change which literally concerns
> millions of sites and developers, it's only to be expected that some
> formal description and discussion of the proposal is required.
Fair enough. Expect to see an RFC once the window for 7.1 opens.
>
>> If people are generally interested in having an
>> array_key_(first|last|index) implementation, I can dust off that PR,
>> update it for master, and if we really need an RFC, I’ll prepare one
>> for PHP 7.1.
>
> I imagine we do need an RFC for something like that. First element can
> be easily accessed with reset and each/current, but the last one is
> harder to access without modifying. So maybe it's be a good addition.
> There's a lot of time till 7.1 yet so you could definitely make a good RFC.
reset + each/current modifies the array pointer, though, so it’s unfortunately not quite that
easy.
-John