[swift-evolution] My personal beef with leading-dot syntax

Jordan Rose jordan_rose at apple.com
Wed Apr 6 11:27:06 CDT 2016


> On Apr 5, 2016, at 0:55 , Radosław Pietruszewski via swift-evolution <swift-evolution at swift.org> wrote:
> 
> As others noted:
> 
> * the ability to say .min, .max, .blackColor(), etc is extremely useful. Swift would be a lot worse off if only enum cases got their enum types inferred, and for any other static member of a type I would have type the fully qualified name
> * the leading dot disambiguates the reference for the compiler **and for the reader**. I don’t have to guess if I’m not referencing something local, or explicitly disambiguate when needed. I just say, “.foo”, and it’s clear.
> * I disagree that the rules of lookup are confusing. The feature is poorly documented in official guides, but it seems pretty straightforward to me. For any context implying T, .foo means a static member T.foo. Like you said, could be subjective ¯\_(ツ)_/¯

I strongly agree with all of these points, especially the second.

Jordan


More information about the swift-evolution mailing list