[swift-evolution] Dotless case names in switch cases

Matthew Johnson matthew at anandabits.com
Mon Jan 18 10:56:17 CST 2016


> On Jan 18, 2016, at 10:42 AM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Jan 16, 2016, at 2:29 AM, Brent Royal-Gordon <brent at architechies.com> wrote:
>> 
>>> This works by normal instance member lookup. Why do you think it should be removed?
>> 
>> Wait, why would the case be an instance member? Isn't it equivalent to a static member?
> 
> You're right, sorry. This is really a holdover from early versions of the compiler where we did 'static' lookup from instance scope. It would be more consistent to disallow it, I agree.

I was just thinking over the weekend that it would be nice if it was possible to have static helper methods that weren’t at a syntactic disadvantage when called from instance methods.  

Interesting that this used to be the case.  Why was it removed?  Problems like this one?

Have you considered allowing types to be explicitly “opened” in a scope, making static members available as if they were defined at the top-level?

-Matthew

> 
> -Joe
> _______________________________________________
> 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