<div dir="ltr">Is a solution to this actually making the leading dot mean enum lookup, full stop and allowing `Self.foo`? The case that that doesn't cover is static members on a type other than `Self`. I use it to great effect for standard instances of types, so I would appreciate *some* facility to provide that, but it doesn't have to be a leading dot if we can think of a way which is less problematic. <div><br></div><div>I am simply spitballing here but would </div><div>1 period for enum look up</div><div>2 periods for static member lookup</div><div><br></div><div>or something similar be a solution? It doesn't use another character or keyword and it makes it clear which feature is being used. <br><div><br></div><div>TJ</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 4, 2016 at 4:22 PM, Howard Lovatt via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Moving away from the compiler, I like the leading dot for the programmer to distinguish static and instance members. The 'missing' receiver natural means static to me. <div class="HOEnZb"><div class="h5"><br><br>On Tuesday, 5 April 2016, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
on Mon Apr 04 2016, Joe Groff <<a>swift-evolution@swift.org</a>> wrote:<br>
<br>
>> On Apr 4, 2016, at 12:51 PM, Dave Abrahams <<a>dabrahams@apple.com</a>> wrote:<br>
>><br>
>><br>
>> on Mon Apr 04 2016, Joe Groff <jgroff-AT-apple.com> wrote:<br>
>><br>
><br>
>>>> On Apr 4, 2016, at 11:44 AM, Dave Abrahams <<a>dabrahams@apple.com</a>> wrote:<br>
>>>><br>
>>>><br>
>>>> on Mon Apr 04 2016, Joe Groff <jgroff-AT-apple.com> wrote:<br>
>>>><br>
>>><br>
>>>>>> On Apr 4, 2016, at 11:05 AM, Dave Abrahams via swift-evolution <<a>swift-evolution@swift.org</a>> wrote:<br>
>>>>>><br>
>>>>>><br>
>>>>>> on Mon Apr 04 2016, Erica Sadun <<a>swift-evolution@swift.org</a>> asked:<br>
>>>>>><br>
>>>>><br>
>>>>>>> Can you ping me off-list or in another thread and explain what the<br>
>>>>>>> issues are?<br>
>>>>>><br>
>>>>>> All of the following make me uncomfortable with our leading-dot thang:<br>
>>>>>><br>
>>>>>> * The rules for lookup don't seem obvious to me. I admit this is very<br>
>>>>>> personal/subjective.<br>
>>>>>><br>
>>>>>> * There is some evidence that people think it means something it doesn't<br>
>>>>>> (“enum case”), as mentioned in SE-0036. That suggests it is a<br>
>>>>>> confusing feature. That confusion may be fairly harmless so far, but<br>
>>>>>> still.<br>
>>>>>><br>
>>>>>> * The dot doesn't seem to buy enough to be worth the complexity it adds<br>
>>>>>> to the language; why not just let those names be looked up without the<br>
>>>>>> dot? You can always disambiguate with full qualification if you have<br>
>>>>>> to.<br>
>>>>><br>
>>>>> Making every unqualified reference context-dependent would be<br>
>>>>> impractical. `foo.bar(bas)` would become an exponential search to find<br>
>>>>> a contextual type containing a `foo` which has a `bar` member that can<br>
>>>>> accept an type containing a `bas` member.<br>
>>>><br>
>>>> I don't think I'm talking about making every unqualified reference<br>
>>>> context-dependent. When I have a context that demands an instance of a<br>
>>>> particular enum type, I think it's reasonable to look up the names in<br>
>>>> the enum without qualification, and I strongly question the value of<br>
>>>> leading-dot syntax for general static member lookup.<br>
>>><br>
>>> Therein lies the rub—*any* context an unqualified name can appear in<br>
>>> could potentially demand an instance of a particular enum type, until<br>
>>> the type checker rules that out. Limiting the behavior to enums<br>
>>> doesn't simplify the implementation.<br>
>><br>
>> I'm afraid I don't understand how that's a serious problem yet.<br>
><br>
> Right now, we limit the contextual lookup to places where it's<br>
> syntactically asked for, using the leading dot. Without the leading<br>
> dot, we'd have to extend it to every unqualified name, which makes it<br>
> much more likely you'll fall into problematic cases.<br>
<br>
I don't know how to evaluate whether that likelihood is a problem in<br>
practice, or not, though.<br>
<br>
--<br>
Dave<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a>swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote><br><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>-- Howard.<br>
</font></span><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>