|
|
|
|
|
by edflsafoiewq
2985 days ago
|
|
No, switch is not like a special case of match. C's switch is a kind of computed goto and can build irreducible control flow graphs. match is a reducible structured control-flow construct whose power comes from destructuring. match is much, much more like an if-else chain than a switch. |
|
Sure is. Or a degenerate one if you prefer.
> match is a reducible structured control-flow construct whose power comes from destructuring.
Match on sum types with no associated data and you have a switch.
> match is much, much more like an if-else chain than a switch.
Depends on what you're matching.