|
|
|
|
|
by aasasd
2269 days ago
|
|
As a technical aside (I know it's not the main point, but still): with the ubiquity of Git workflows employing pre-merge checking on the platform of choice (e.g. Github or a CI tool), this is rather easily done via a rule in an off-the-shelf linter. No `break` in a `case`? Can't merge it. As a language-design aside, `switch` in general is stinky stuff. Not just with the fall-through: it also violates the regular C-style syntax for no particular reason, having a mini-syntax of its own instead. But the most perverse thing I've seen done with `switch` is using it as `if`: switch (true) {
case ($a == $b): ...
case ($c == $d): ...
case (itsFullMoonToday()): ...
default: ...
}
|
|