-
Notifications
You must be signed in to change notification settings - Fork 65
Range matching patterns? #12
Comments
This would be easy enough with an I'm not a huge fan of using |
That's a neat solution. 1 (to either |
Is using range() as a match expression ambiguous? Does In some regards a slice operator makes more sense as a matching expression, but I don't think that works syntactically. |
I'm sure |
Let me perhaps give another reason why Range checks of that form are probably better and quite adequately expressed through classic Syntax like Finally, |
Agreed -- unless there are strong objections, let's mark this one as "rejected". Another reason against Speaking of floats, syntactically (However, I don't think that the character range arguments holds water -- we could always declare that it would have to be a string containing a single unicode character. We do this for |
Yes, implementing range patterns with dedicated syntax is a waste. We can implement this with current protocol. |
But we should not. I have seen your hack and think it is too obfuscated. |
If you can support parameterised patterns in some way, it won't be obfuscated at all. |
Some languages have range cases, so you could write e.g.
case 1...6: print("Dice")
. This seems tricky, and quite specialized. Let's not do this?The text was updated successfully, but these errors were encountered: