Re: Introducing "Array Of" RFC
| From: | Sara Golemon | Date: | Mon, 20 Jan 2014 21:37:12 +0000 |
| Subject: | Re: Introducing "Array Of" RFC | ||
| 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-71360@lists.php.net to get a copy of this message | ||
>> To quote someone who's skill and abilities I respect: "Just because
>> they do it some way in X, doesn't mean it belongs in PHP."
>
> That is true. But this is not "just because" - I'm not arguing about any
> specific syntax or even semantics. I'm talking about all of them not
> even going in that general direction and still being fine. That makes me
> question if the need for generics is that great and if they actually are
> a good fit for a dynamic language, at least in a way that they are
> presented - i.e. as type checking mechanism, not as code generation
> mechanism. I could repeat the regular arguments why I think they are not
> if you'd like - I did it on this list like 100 times and everybody is
> tired and hating me for that already, but I could do it again on popular
> request. So it's not the only argument. It is an additional argument
> providing some perspective.
>
This is an issue that keeps coming up. Calling for typed arrays to
look like generics is not the same as calling for generics.
It's an acknowledgement that there is a fundamental shared behavior
between the two. A generic implementing ArrayAccess and Traversable
is not different **FROM A USERSPACE POINT OF VIEW** from a typed array
(apart from object psuedoreference semantics and the ability to check
on input). Given that they look the same **FROM A USERSPACE POINT OF
VIEW**, they should share common syntax.
This does not mean that we have to add (or even agree to add) generics
in order to adopt typed arrays. This does not mean the implementation
of typed arrays need share anything in common with generics should
they be someday be voted in.
This is just thinking of the consistency of the language.
This is about how the user interacts with the syntax.
-Sara