Re: Introducing "Array Of" RFC
| From: | Philip Sturgeon | Date: | Mon, 20 Jan 2014 20:20:00 +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 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71345@lists.php.net to get a copy of this message | ||
On Mon, Jan 20, 2014 at 2:48 PM, Robert Stoll <php@tutteli.ch> wrote:
>>
>> I would love to get generics as long as typed arrays. And when I say typed
>> arrays I mean array which can hold only the elements of said class (not an
>> interface). It's not just semantics, it's also optimization that can be
>> done when you know that array will hold only elements of the said type.
>> (You know how much memory element will take. It'll make a room for
>> possible optimizations)
>>
>
> Hm.. I did not understand the RFC this way. It says, "allowing an array of that hinted
> type to be passed as an argument", so I assumed it would work with interfaces as well.
> And what about sub-types?
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
The RFC supports type-hinting against anything that you can currently
type-hint against, just with the addition of [] to say "an array of
them."