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

Joe Groff jgroff at apple.com
Mon Apr 4 13:17:51 CDT 2016


> On Apr 4, 2016, at 11:05 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Mon Apr 04 2016, Erica Sadun <swift-evolution at swift.org> asked:
> 
>> Can you ping me off-list or in another thread and explain what the
>> issues are?
> 
> All of the following make me uncomfortable with our leading-dot thang:
> 
> * The rules for lookup don't seem obvious to me.  I admit this is very
>  personal/subjective.
> 
> * There is some evidence that people think it means something it doesn't
>  (“enum case”), as mentioned in SE-0036.  That suggests it is a
>  confusing feature.  That confusion may be fairly harmless so far, but
>  still.
> 
> * The dot doesn't seem to buy enough to be worth the complexity it adds
>  to the language; why not just let those names be looked up without the
>  dot?  You can always disambiguate with full qualification if you have
>  to.

Making every unqualified reference context-dependent would be impractical. `foo.bar(bas)` would become an exponential search to find a contextual type containing a `foo` which has a `bar` member that can accept an type containing a `bas` member.

-Joe


More information about the swift-evolution mailing list