3 ms·
I think C is fine for a simple compiler. Why are algebraic data types so relevant? Pattern matching is nice, because switch statements plus unpacking is more ve
by qznc 9y ago
I think C is fine for a simple compiler. Why are algebraic data types so relevant? Pattern matching is nice, because switch statements plus unpacking is more verbose.
For big optimizing compilers you appreciate abstractions like C++ enables. for example, a data flow Analysis framework.
- jmite 9y agoAlgebraic data is just so perfectly suited to abstract syntax. It's clearly possible to model an AST in C, but not to do it in an ergonomic z typesafe way.
- ufo 9y agoIn addition to being more succinct, algebraic data types are also better about warning if you forgot to handle one of the cases.