Programming languages should provide at least two separate switch statement keywords, one for fall through and one for no fall through, instead of forcing one or the other.

Programming languages with switch control flow statements typically seem to either (1) make it so that switch statements have fall through behavior (which is often error prone, since it is the less common use case) or else (2) force switch statements to never fall through. Neither of these choices is the wisest choice though.

There is no actual reason why a programming language should be forced into being artificially handicapped by either of these variants’ weaknesses. Instead, the programming language could simply make two different keywords available for switch statements, in such a way as to clearly indicate which behavior will be the result.

Continue reading Programming languages should provide at least two separate switch statement keywords, one for fall through and one for no fall through, instead of forcing one or the other.