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]