[swift-evolution] [Pitch] Adding a Self type name shortcut for static member access

Brent Royal-Gordon brent at architechies.com
Fri Apr 22 23:56:26 CDT 2016

>> Having said all this, now that we have `#Self`, I'm wondering if we still want `Self` in value types. The two are *exactly* equivalent in value types as far as I can tell, and `Self` in classes implies dynamic behavior which is not supported by value types. The use of `Self` in class member bodies is a clean win, the existence of `#Self` is a clean win, but I'm not sure we need the value type thing too.
> If subtyping for value types will be introduced someday (there has been considerable interest for that already) `Self` would make sense for value types, too, wouldn't it?

Sorry for the delay answering this; I have been (and will continue to be) rather busy.

It depends on the form of the subtyping support. If "subtype" just means "implicit conversion without sharing compatible representations", as having Float be a subtype of Double would be, that wouldn't necessarily make much sense. But if it's some kind of pseudo-subtyping system (though how would that work with the non-reference-based representation of structs, I don't know), then that would perhaps make more sense.

Brent Royal-Gordon

More information about the swift-evolution mailing list