Post #3650240
2026-07-02 05:40 UTC
@pinskia@hachyderm.io If specific cases habitually share code with each other (or should usually be looked through), you can just teach your visitor about that. Done well, it’s a really nice way to abstract over different patterns of exhaustive pattern matching snd can make sense even in languages with decent pattern matching built in. Having to manually handle all the data flow in and out can be a pain, but on balance I still think it’s good.
Replies (1)
-
@rjmccall@hachyderm.io 2026-07-02 05:47
@pinskia@hachyderm.io The alternatives I regularly see, like checking ten different cases in a big if/else, are extremely prone to non-exhaustive or inconsistent handling. It’s fine if you really do just want to recognize a few special cases, like simple peepholing, but there are a lot of things in compilers that are supposed to be exhaustive over types/decls/exprs/insts, and some set up to promote that is s good trade