[swift-evolution] [Discussion] Enum Leading Dot Prefixes

Jordan Rose jordan_rose at apple.com
Fri Feb 12 13:18:46 CST 2016


Ah, I misread that as you wanting to enforce it rather than allow it! I'm with Joe; we can just consider that a bug. Mind filing it on bugs.swift.org?

Jordan

> On Feb 12, 2016, at 10:24, David Waite <david at alkaline-solutions.com> wrote:
> 
> I think you may have misunderstood - I’m asking if we can make your switch example into legal code :-)
> 
> var point = CGPoint.zero
> 
> switch point {
> case .zero: // Error: Enum case 'zero' not found in type 'CGPoint'
> 
> -DW
> 
>> On Feb 12, 2016, at 10:57 AM, Jordan Rose <jordan_rose at apple.com <mailto:jordan_rose at apple.com>> wrote:
>> 
>> 
>>> On Feb 11, 2016, at 22:27 , David Waite via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>> Would it be worthwhile to expand this (or create another proposal) to deal with switch cases only allowing dot syntax for use with enum cases?
>> 
>> I would be against that. I like being able to use static members with shorthand.
>> 
>> textField.font = .systemFontOfSize(48)
>> 
>> switch point {
>> case .zero:
>>   print("origin")
>> case _ where point.x < 0:
>>   print("negative x")
>> default:
>>   print("uninteresting")
>> }
>> 
>> Jordan
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160212/8ece8b67/attachment.html>


More information about the swift-evolution mailing list