I’m not sure I understand your point about fall through having to be explicit
As far as i understand it, every switch statement requires a break
otherwise it's a compiler error - which makes sense from the "fallthrough is a footgun" C perspective. But fallthrough isnt the implicit behavior in C# like it is in C - the absence of a break
wouldnt fall through, even if it wasnt a compiler error. Fallthrough only happens when you explicitly use goto
.
But break
is what you want 99% of the time, and fallthrough is explicit. So why does break
also need to be explicit? Why isnt it just the default behavior when there's nothing at the end of the case?
It's like saying "my hammer that's on fire isnt safe, so you're required to wear oven mitts when hammering" instead of just… producing a hammer that's not on fire.
From what i saw on the internet, the justification (from MS) was literally "c programmers will be confused if they dont have to put breaks at the end".
Honestly, it's because a bunch of programs i used disappointed me (performance, functionality, [being a web app at all], etc.) and i figured it couldnt be that hard to do it better. In some cases i was right, in most i was wrong. As it turns out though, I really like programming so i guess i'm stuck here