|
|
|
|
|
by krapht
2180 days ago
|
|
In lower level languages, when you use switch, you make it easier for the compiler to generate a jump table. In higher level langues with strong, static types, the switch statement can indicate to the compiler you want to match on the type of the variable; it can do analysis then to make sure your pattern match is exhaustive. |
|
For higher level languages, I would imagine typeguards would provide some of the desired functionality here, while being much more lightweight than a full alternative conditional syntax.