Re: Typed array properties V2
| From: | Matthew Brown | Date: | Tue, 21 Jan 2020 21:21:06 +0000 |
| Subject: | Re: Typed array properties V2 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108209@lists.php.net to get a copy of this message | ||
> As far as I know, the only viable way to do that is to make the array
> intrinsically typed, which means that types are validated when elements are
> inserted into the array, not when it is passed across a function boundary.
> In other words, array generics.
>
What if we left the array type alone, and instead focussed on "list<Foo>"
type and "dict<string, Foo>", "dict<int, Bar>" types?
That would allow a clear break from previous behaviour, and would allow you
to introduce other changes (e.g. removing string -> int coercion for
numeric string keys).