Re: RFC - Array slice syntactic sugar
| From: | Rowan Collins | Date: | Fri, 20 Mar 2015 16:09:07 +0000 |
| Subject: | Re: RFC - Array slice syntactic sugar | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85301@lists.php.net to get a copy of this message | ||
Alex Bowers wrote on 20/03/2015 16:00:
IMHO, stick to offsets in the first instance, this is a slice
notation, first order of business is to make it behave like
array_slice (+on strings). Assoc key based slicing feels pretty
wrong to me at this point.
I have to agree, we are getting ahead of ourselves.
A quick summary of what this RFC should cover:
- Slicing an array or string based on the positional index.
Things for future RFC consideration:
- Slicing an array or string based on the key.
- Index -1 for last item of list.
Everybody agree that the only focus of this RFC should be the positional index slicing?
I'd be tempted to introduce the ability to get a single element by position as well, just because that would be a really useful feature, and "accessing array elements by their position" is kind of pre-requisite for "accessing a set of array elements by their positions" anyway. It might also make the rationale for the eventual syntax more obvious to those who haven't been reading this conversation. :)
Regards,
--
Rowan Collins
[IMSoP]