Complementary case syntax #17782
som-snytt
started this conversation in
Feature Requests
Replies: 2 comments
-
It would be nice to have: case P
if C1 => ...
else if C2 => ...
else => ... |
Beta Was this translation helpful? Give feedback.
0 replies
-
@LPTK I knew the brilliant creative community would not let me down. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Someone asked about refactoring
to
It would be nice if the cases were connected by syntax, since they are complementary.
Maybe not
and maybe not
I am still an advocate for
so I think the problem space is unexplored. Where are the creative EPFL masters students?
In Scala 2, the impetus is to avoid parens around
if
conditions. But maybe it's also nicer in Scala 3 to split conditional cases as actual cases. Possibly users worry that the desugaring will be less efficient?An additional desideratum might be to enforce complementarity in the face of intervening cases:
Beta Was this translation helpful? Give feedback.
All reactions