I encountered the same issues and agree that it can be tedious to deal with 
enums.
Imho the first variant (skipping the switch(self) {} doesn't offer enough 
benefit to justify a special case.

The second is nice because it keeps the "properties" of each case together — 
but afaics, Swift doesn't use the model of case classes (like 
http://docs.scala-lang.org/tutorials/tour/case-classes.html) for its enums, so 
it is no good fit for the language (btw, shouldn't the cases be lower case?).

As "isRed" is declared as "var", I would expect it can be changed, but it's 
redeclared "let" afterwards… maybe this could be simplified by using each 
case-block like an init-method:
   enum Suit: Int {
       let isRed: Bool

       case Hearts {
          isRed = true
       }
….

Tino
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to