4 ms·
Are algebraic data types supported? Can you do compiler checked exhaustive pattern matching on a sum type?
by zinclozenge 6y ago
Are algebraic data types supported? Can you do compiler checked exhaustive pattern matching on a sum type?
- beagle3 6y agoYes, they are supported. There are a few libraries for that, e.g. Patty, which IIRC supports exhaustive pattern matching. Nim macros are as-powerful-as-Lisp-sans-reader-macros, and usually easier to write and use. A lot of things that require language revisions in most languages (e.g. async/await and pattern matching in Python/C#/JavaScript) are user-level constructs in Nim.