Re: [RFC][DISCUSSION] Collection Inspection
| From: | Rowan Collins | Date: | Thu, 25 Jan 2018 20:10:27 +0000 |
| Subject: | Re: [RFC][DISCUSSION] Collection Inspection | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101671@lists.php.net to get a copy of this message | ||
On 25/01/2018 14:52, Derick Rethans wrote:
IMO, it makes a lot more sense to check integrity when creating the "array" structure. Instead, I would suggest to add a native Collection type, that takes a "type" as argument. They aren't quite full generics, but it does 1. fix something; 2. isn't really complicated. What I am suggesting is to add a new syntax "Collection<$type>", mimicking a class, but having a type as "argument": $a = new Collection<integer>;So would I be right in thinking this would mean adding basic support for generics to the engine, but not letting new ones be defined in userland? So, a bit like how internal or extension classes have the ability to do more overloading of casts and operators than userland classes? If so, I like the concept, but wonder whether the parts of the implementation it would need are the easy parts of the hard ones. I guess not being able to inherit from the generic would get rid of a bunch of complexity, but don't really know where else the challenge lies. Regards, -- Rowan Collins [IMSoP]