Skip to content
This repository was archived by the owner on Mar 27, 2019. It is now read-only.

Updated spec to handle sequential traversables better #46

Closed
ezzatron opened this issue Apr 29, 2015 · 3 comments
Closed

Updated spec to handle sequential traversables better #46

ezzatron opened this issue Apr 29, 2015 · 3 comments

Comments

@ezzatron
Copy link
Contributor

There is currently no formal way to specify a sequential array, or iterator.

I've taken to using array<integer,type> since arrays with integer indices in PHP are typically sequential. But others have adopted array<type>, even though this is actually equivalent to array<mixed,type>, which in no way restricts the indices.

After discussions, the best solution seems to be to release a new version of the spec, where array<type>, mixed<type>, ClassName<type> etc. all indicate that indices will be sequential integers. array<mixed,type> is still available for the rarer case where index type is flexible. Additionally, the other edge case of non-sequential integer indices can still be expressed with array<integer,type>.

@jmalloc
Copy link
Member

jmalloc commented Apr 29, 2015

+1

@koden-km
Copy link

Nice

@ezzatron
Copy link
Contributor Author

array by itself will probably need to be assumed to be a sequence also - not sure how I feel about this one, as it differs from the native array type hint's restrictions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants