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

David Waite david at alkaline-solutions.com
Fri Feb 12 14:19:28 CST 2016


You got it. SR-719 and also SR-720.

-DW

> On Feb 12, 2016, at 12:18 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> 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 <http://bugs.swift.org/>?
> 
> Jordan
> 
>> On Feb 12, 2016, at 10:24, David Waite <david at alkaline-solutions.com <mailto: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/3622be2f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4139 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160212/3622be2f/attachment.p7s>


More information about the swift-evolution mailing list