Re: Introducing "Array Of" RFC

From: Date: Mon, 20 Jan 2014 19:51:53 +0000
Subject: Re: Introducing "Array Of" RFC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-71341@lists.php.net to get a copy of this message
> Why should this RFC get put on hold forever because people cannot come > to an agreement about scalar type hints? Why would it be better, > quicker, or easier this time? :) > It shouldn't, by any measure. I'm just saying that ignoring scalars doesn't buy us anything in understanding how typed array hints are useful. The topic is argument type hinting, scalars are a component of that, even if not an essential component of this RFC. >> ArrayOf is not a separate topic from Generics, it is by definition a >> narrowly-scoped form of generics. "ArrayOf Foo" is a "Foo" >> specialization of the array generic (even if it's not labeled as such >> due to not having other types of generics). "This is an array, but >> it's an array just for Foos". Can arrayof be implemented in a way >> which hides this heritage? Sure, but should it? > > I respectfully but strongly disagree. > > This feature: "I would like a bag of spanners" > > Generics: "I would like a **polyester** bag full of spanners, and this > is how you should put those spanners into that bag." > I respectfully by strongly disagree. ArrayOf: "I would like hammers in a bag." Generics: "I would like a bag of hammers." > Pros > ----- > > You can be very certain what you are putting in there > It's a little quicker than checking an array of content > > Cons > ----- > > Definitely "forcing OOP on people" > Require the user to do stuff outside of the method declaration that > they dont care about > It's a whole new topic, instead of a simple improvement. > These arguments apply to broadly-scoped Generics, but not to the specifics of presenting arrays as a generics specialization. It does not enforce OOP on anyone. It does not require anyone to do anything outside of the method declaration. I'm sorry, but those arguments are simply untrue. > I know you'd like to see generics in PHP, and while I personally don't > care too much about them you have support from Joe and others. It > would be great of generics could be done, but this is not generics. > This is "I want an array of Foo", which soon will be "I want an array > of integers". I hope to god we don't suggest that people create a > generic to ask for an array of co-odinates. > I agree, and I'm not asking for Generics. Honestly, I'm not even too bothered whether we see generics or not, so don't tell me what my opinions are. I'm including a discussion of generics in my comments on ArrayOf because of their clear overlap. I'm sorry you can't see that. >> Ignoring elements which fit closely together is a short-sighted mistake. >> > And trying to bundle things in together which seem to vaguely overlap > is a very quick way to get stuck in the mud. :) > Yes, but that has nothing to do with the topic at hand since they fit so well together. I can't imagine why you included such a nonsequiter... -Sara

« previous php.internals (#71341) next »