Re: Introducing "Array Of" RFC

From: Date: Mon, 20 Jan 2014 22:00:39 +0000
Subject: Re: Introducing "Array Of" RFC
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-71363@lists.php.net to get a copy of this message
Please excuse my lack of knowledge, but if I understand this correctly, this is how generics would work ... using arrays, ignore the syntax and details such as child classes, interfaces, etc.: $fruits = Array<Fruit>; - declare that $fruits is an array that can only contain instances of class Fruit function eat(Array<Fruit> $apples) - function eat() will only accept arrays that are declared in the same way as $fruits above If that is so, then I deffinately see how this RFC is similar to generics and how generics would give us higher performance. But I also see how it is different and how it serves for another (yet indeed similar) purpose. I wouldn't rule out either feature, but if that is what you people want, why don't you vote on: a) array of; b) generics; c) both and be done with it. I surely do understand why Phil Sturgeon got so heated about the discussion going nowhere - at least 3 separate topics are being discussed here and everybody has an opinion on all of them separately. This isn't productive.

« previous php.internals (#71363) next »