[swift-evolution] Dot notation as shorthand in subscripts and functions

Brent Royal-Gordon brent at architechies.com
Sat Jan 16 04:24:23 CST 2016


> When used in a switch statement the dot notation is a kind of shorthand reference to the type of an enum, but it also seems like for non enums it could be a shorthand reference to self, allowing us to avoid having to write out variable references in a few common cases.

I think you don't realize how broad the existing leading-dot feature is.

Leading dot can be used in any place where a type can be inferred to access a static member of that type. For instance, it also allows this:

	textField.textColor = .whiteColor()

Because it's not limited to just enums, the existing meaning would almost *always* conflict with the meaning you propose.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list