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

Chris Lattner clattner at apple.com
Fri Feb 12 11:26:10 CST 2016


> On Feb 11, 2016, at 10:41 PM, Carlos Parada via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Taking consistency further, should the definition also use dot prefixes?

I agree with others’ comments downthread.  The goal here is to make enum cases more similar to static members, since that is how they behave.  Both static members and enum cases can be referred to with the leading dot syntax already, and we wouldn’t add dot to the declaration of static members.

-Chris


> For example:
> 
>> enum Coin {
>>     case .Heads, .Tails
>>     func printMe() {
>>         switch self {
>>         case .Heads: print("Heads")
>>         case .Tails: print("Tails")
>>         }
>>     }
>> }
> 
> — Carlos Parada
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list