[swift-evolution] [Proposal] Disallow redundant `Any<...>` constructs
brent at architechies.com
Fri May 20 22:47:11 CDT 2016
> One more point around this comment. While `any<MyProtocol>` is a type `any` is not a type. `any` is a kind of type. We have classes, structs, enums, and existentials. We don’t capitalize `struct`, `class`, or `enum`. Why should we capitalize `any` just because it is often going to be declared ad-hoc (and again, I think it is worthwhile to give existential types a name in many cases, just as we give other types a name — preferring structs to tuples, for example). Making `any` lowercase emphasizes the fact that it is a kind of type rather than a type.
The current `Any`, and the proposed `any<>` (and `any`, which I'm presuming is equivalent), *are* types. They are not categories of types like `class` or `struct` or `enum`; you can declare variables as them, you can cast to them, you can check if values match them. You probably ought to be able to take an `Any<Foo, Bar>.Type` and call a `Foo` or `Bar` initializer on it to get an `Any<Foo, Bar>` (although I don't know if Swift supports that right now). In short, you can do all the things with them that one would expect to do with a type. Because they are types.
So if you're saying that `any<>`/`Any<>` is not a type, I think you're quite wrong. If you're saying that `any<>`/`Any<>` is a type but `any`/`Any` is not, then we disagree on my position that these should be equivalent.
More information about the swift-evolution