Re: [RFC] Typed array declarations
| From: | Wendell Adriel | Date: | Tue, 21 Jul 2026 09:12:13 +0000 |
| Subject: | Re: [RFC] Typed array declarations | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132064@lists.php.net to get a copy of this message | ||
Hey Larry,
I am opposed to this RFC, for all the reasons Rob mentioned. Moreover, I
> don't believe the issues can be resolved by just waiting for the reified
> generics RFC (which I really hope passes). The core issue is that PHP
> arrays are an over-broad data structure, and we need to have a hard,
> type-based (not just implied by generics) distinction between
> lists/sequences, sets, and dictionaries/maps, the same way most languages
> do.
> There are a few ways that could be done: 3 generic objects (a la Kotlin,
> my preferred approach), 3 generic objects with extension functions
> (assuming we can get those), 3 new core data types with extension functions
> (very hard to implement as I understand it), etc.
> But tacking it onto the already-dangerously-overloaded array mega-type is
> the wrong approach.
Thanks for the feedback.
I understand the concern of adding more things to the array type and I
think it's a valid concern.
Would you think that an RFC adding new types, maybe using Kotlin as a
reference (as you mentioned), for having strongly typed array/list
structures would be a better fit?
I'd be happy to propose and work on this if this would be a better
direction/approach.
*---*
*Best Regards,*
*Wendell Adriel.*
*Software Engineer & Architect*
*https://wendelladriel.com <https://wendelladriel.com>*