new keyword for implicit switch statements #1088
-
There are many good reasons for requiring switch statements to inherit its C equivalent but the statement; |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments
-
How do you supply a value from a case? |
Beta Was this translation helpful? Give feedback.
-
When planning pattern matching in C# 7.0 the LDC discussed using an alternative syntax that would have been less verbose than They're now having similar discussions around an expression form. So if you have an opinion about that that's the place to express it. |
Beta Was this translation helpful? Give feedback.
-
We could simply make |
Beta Was this translation helpful? Give feedback.
-
@stepanbenes It would not be ambiguous, true. But it would be incredibly confusing to anyone who knows another C-descended language, including C++ and Java. |
Beta Was this translation helpful? Give feedback.
-
See dotnet/roslyn#959. |
Beta Was this translation helpful? Give feedback.
-
Yes, the language team could make Whilst the |
Beta Was this translation helpful? Give feedback.
-
@DavidArno You seem to like the idea. :) However, @svick is right that it would bring confusion (not for me, I hate the fall-through behavior in C++ and never use it). Another reason to use |
Beta Was this translation helpful? Give feedback.
-
I wouldn't mind making |
Beta Was this translation helpful? Give feedback.
-
Sometimes I agree with @svick; sometimes I strongly disagree with him. This is one of those latter cases. "It'll confuse the little bunnies used to how C++ and Java work" is, in my view, the single worst excuse for not fixing a bad feature, ever. |
Beta Was this translation helpful? Give feedback.
-
^ Rude. |
Beta Was this translation helpful? Give feedback.
-
Only a little bit 😉 |
Beta Was this translation helpful? Give feedback.
-
Swift has a C-based syntax with a lot of changes like optional parens around |
Beta Was this translation helpful? Give feedback.
-
I think switch expressions cover this, especially with the proposal to allow a statement form of the switch expression: #3038 |
Beta Was this translation helpful? Give feedback.
I think switch expressions cover this, especially with the proposal to allow a statement form of the switch expression: #3038