2 ms·
Yeah, in any modern language with pattern matching stuff like this is absolutely the compiler's job, and can be done pretty well[1] - of course, there are plent
by blueberry87 3y ago
Yeah, in any modern language with pattern matching stuff like this is absolutely the compiler's job, and can be done pretty well[1] - of course, there are plenty of legacy languages that don't have pattern matching, but seeing as it can be compiled straight to switches and whatnot, even the lowest level languages don't have /that/ much of an excuse.
refs:
[1]: http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf http://moscova.inria.fr/~maranget/papers/ml05e-maranget.pdf
https://julesjacobs.com/notes/patternmatching/patternmatching.pdf https://julesjacobs.com/notes/patternmatching/patternmatchin...