Re: [RFC] Typed array declarations
| From: | Wendell Adriel | Date: | Thu, 16 Jul 2026 14:18:29 +0000 |
| Subject: | Re: [RFC] Typed array declarations | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131972@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.
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>*