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

Matthew Johnson matthew at anandabits.com
Sat Jan 16 08:56:09 CST 2016

> On Jan 16, 2016, at 4:24 AM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>> 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.

Not exactly what is discussed in this thread, but there is a way to expand the dot shorthand without overlapping the current shorthand: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/003269.html

> -- 
> Brent Royal-Gordon
> Architechies
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

More information about the swift-evolution mailing list