Hi Richard,

czw., 27 cze 2024, 22:33 użytkownik Richard Miles <richard@miles.systems>
napisał:

>
> > I worked with Joe Watkins to do a proof-of-concept for generic traits.
> > It's a bit old since it's from 2017, but could be a useful starting
> > point if you are serious about pursuing this idea:
> >
> >
> https://github.com/php/php-src/compare/master...morrisonlevi:php-src:parameterized_traits
>
>
> I’m also interested in this; it will help see branches like these.
> Did you ever get the POC working? What did you feel like was the biggest
> hurdle?
>

There even was an RFC in voting which Joe implemented and it addresses
nearly what is discussed it this thread https://wiki.php.net/rfc/arrayof

I must admit that the collection<Dict> proposal is bit too complex to
address such tiny but powerfully in my opinion functionality which is typed
array. What Derick showed looks more like generic collection and such
require declaring it's type. In my opinion this is way too mush hassle to
declare as many collection types as many usages in application. Also two
collection types with the same collection item type will not be compatible
from type perspective. While typed array seems much more clear and
compatible in all places where typed array is needed without declaring
separate type for each usage.

If I were to choose between typed-array and collection like Derick showed a
little bit I'd choose typed arrays definitely as a first feature to be
merged into PHP.

Cheers,
Michał Marcin Brzuchalski

>

Reply via email to