Is it possible to reprioritize case var to be the same as default
#9963
Replies: 4 comments 15 replies
-
I really don't like that. 'cases' have never had that behavior. And it's been extremely easy to explain what happens with pattern cases that they simply match in order, and first wins. |
Beta Was this translation helpful? Give feedback.
-
|
Why does Is it just |
Beta Was this translation helpful? Give feedback.
-
|
Not to mention |
Beta Was this translation helpful? Give feedback.
-
|
I used to presenting alternative that there should be a way to define variable with What I want is that I can do the same logic but order it first because it was the smallest logic. Other logic would be longer below in switch I was trying to propose this instead because |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Since there is not possible to match anything below
case var xI think it would be more natural to allowcase var xin any order and treat it as equivalence todefault. Actually thecase varis more like mutually exclusive withdefaultI would like to propose that compiler should be like this
The error logging logic could be more simplified in switch case with this
Beta Was this translation helpful? Give feedback.
All reactions