Re: [PHP-DEV] [RFC] Typed array declarations

[email protected] (Wendell Adriel) Tue, 21 Jul 2026 10:12:13 +0100
Newsgroups php.internals
Message-ID <CA+1VZ8sz3duFWXK26ViVMM5YqdLHWNKGFOdsXGjkgA_bC3qW5A@mail.gmail.com>
--000000000000d24dee06571b6b7b
Content-Type: text/plain; charset="UTF-8"

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>*

--000000000000d24dee06571b6b7b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div><div class=3D"gmail_default" style=
=3D"font-family:arial,sans-serif;font-size:small;color:rgb(0,0,0)">Hey Larr=
y,</div><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;=
font-size:small;color:rgb(0,0,0)"><br></div><blockquote style=3D"margin:0px=
 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" cla=
ss=3D"gmail_quote"><span class=3D"gmail_default" style=3D"font-family:arial=
,sans-serif;font-size:small;color:rgb(0,0,0)"></span>I am opposed to this R=
FC, for all the reasons Rob mentioned.=C2=A0 Moreover, I don&#39;t believe =
the issues can be resolved by just waiting for the reified generics RFC (wh=
ich I really hope passes).=C2=A0 The core issue is that PHP arrays are an o=
ver-broad data structure, and we need to have a hard, type-based (not just =
implied by generics) distinction between lists/sequences, sets, and diction=
aries/maps, the same way most languages do.</blockquote><div class=3D"gmail=
_default" style=3D"font-family:arial,sans-serif;font-size:small;color:rgb(0=
,0,0)"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex"><br></blockquote><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex">There are a few ways that =
could be done: 3 generic objects (a la Kotlin, my preferred approach), 3 ge=
neric objects with extension functions (assuming we can get those), 3 new c=
ore data types with extension functions (very hard to implement as I unders=
tand it), etc. </blockquote><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x"><br></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">But t=
acking it onto the already-dangerously-overloaded array mega-type is the wr=
ong approach.</blockquote></div><br clear=3D"all"></div><div><div class=3D"=
gmail_default" style=3D"font-family:arial,sans-serif;font-size:small;color:=
rgb(0,0,0)">Thanks for the feedback.</div><div class=3D"gmail_default" styl=
e=3D"font-family:arial,sans-serif;font-size:small;color:rgb(0,0,0)">I under=
stand the concern of adding more things to the array type and I think it&#3=
9;s a valid concern.</div><div class=3D"gmail_default" style=3D"font-family=
:arial,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class=3D=
"gmail_default" style=3D"font-family:arial,sans-serif;font-size:small;color=
:rgb(0,0,0)">Would you think that an RFC adding new types, maybe using Kotl=
in as a reference (as you mentioned), for having strongly typed array/list =
structures would be a better fit?</div><div class=3D"gmail_default" style=
=3D"font-family:arial,sans-serif;font-size:small;color:rgb(0,0,0)">I&#39;d =
be happy to propose and work on this if this would be a better direction/ap=
proach.</div><br></div><div><br></div><div><div dir=3D"ltr" class=3D"gmail_=
signature"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"l=
tr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><di=
v dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=
=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><b><span style=3D"font-family:ve=
rdana,sans-serif"><span style=3D"font-size:13.3333px">---</span></span></b>=
<span style=3D"font-family:verdana,sans-serif"><span style=3D"font-size:13.=
3333px"><br></span></span></div><div dir=3D"ltr"><b><span style=3D"font-fam=
ily:verdana,sans-serif"><span style=3D"font-size:13.3333px">Best Regards,</=
span></span></b><br></div><div><b><span style=3D"font-family:verdana,sans-s=
erif"><span style=3D"font-size:13.3333px">Wendell Adriel.</span></span></b>=
</div><div><b style=3D"font-family:verdana,sans-serif;font-size:13.3333px">=
Software Engineer &amp; Architect</b><b><span style=3D"font-family:verdana,=
sans-serif"><span style=3D"font-size:13.3333px"><br></span></span></b></div=
><div><b><span style=3D"font-family:verdana,sans-serif"><span style=3D"font=
-size:13.3333px"><span style=3D"color:rgb(255,127,0)"><a href=3D"https://we=
ndelladriel.com" target=3D"_blank">https://wendelladriel.com</a></span></sp=
an></span></b></div></div></div></div></div></div></div></div></div></div><=
/div></div></div></div></div></div></div></div></div>

--000000000000d24dee06571b6b7b--