Re: [RFC] Typed array declarations
| From: | Wendell Adriel | Date: | Fri, 17 Jul 2026 10:41:05 +0000 |
| Subject: | Re: [RFC] Typed array declarations | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131990@lists.php.net to get a copy of this message | ||
>
> There are some problems here:
> 1. You have limited K to int or string, but none of these types can be
> subtyped. As a result K1<:K2 never applies. We can only have K1:=K2.
> 2. You also claim that V is covariant. However, this holds true only for
> read-only arrays. Write operations of an array use V in contra-variant
> positions.
> I am afraid that we cannot have sound covariant subtyping of an array,
> unless we clearly separate the read interface from the write one.
Hello there,
Lazare, once again, thanks for the feedback:
I just published a v0.2 of the RFC with changes based on your feedback if
you want to take a look at it.
Also, for other members of Internals, I'd be happy to get your feedback on
this.
I plan to start implementation as soon as we agree on an Implementation
Level I should aim for.
Thanks in advance.
*---*
*Best Regards,*
*Wendell Adriel.*
*Software Engineer & Architect*
*https://wendelladriel.com <https://wendelladriel.com>*
Em qui., 16 de jul. de 2026 às 15:18, Wendell Adriel <
wendelladriel.ti@gmail.com> escreveu:
> There are some problems here:
>
>
>> 1. You have limited K to int or string, but none of these types can be
>> subtyped. As a result K1<:K2 never applies. We can only have K1:=K2.
>> 2. You also claim that V is covariant. However, this holds true only for
>> read-only arrays. Write operations of an array use V in contra-variant
>> positions.
>
>
>> I am afraid that we cannot have sound covariant subtyping of an array,
>> unless we clearly separate the read interface from the write one.
>
>
> Hey Lazare,
>
> Thank you for the feedback.
> I'm going to analyze this and update the RFC document accordingly ASAP.
>
> *---*
> *Best Regards,*
> *Wendell Adriel.*
> *Software Engineer & Architect*
> *https://wendelladriel.com
> <https://wendelladriel.com>*
>