[swift-evolution] [Pitch] Reimagining guard case/if case

drive at marcopace.it drive at marcopace.it
Tue Oct 25 08:06:24 CDT 2016


Hi,
I agree removing the "case" word after the "if" / "guard", but I prefer 
removing it completely rather then make it optional to limit the number 
of different implementation.

Regarding the operator, I agree that it can be improved because we 
should find something that contains two different operations:
   - check against the pattern
   - assign the value

For me both "is" and "match" miss one of the two part: the "is" keyword 
doesn't feel like a check against the pattern to me, while the "match" 
keyboard doesn't contain information regarding the assignation.

+1 for Erika proposal, I like the idea of using "~=", it explicits both 
operations and it is an operator already used in Swift for a similar 
use-case.

Marco


More information about the swift-evolution mailing list