3 ms·
Interesting. What about OCaml? I assume they have some kind of macro support. Assuming it is not as simple to work with as Lisp, how does it compare to the "Ha
by anonymousDan 17y ago
Interesting. What about OCaml? I assume they have some kind
of macro support. Assuming it is not as simple to work
with as Lisp, how does it compare to the "Haskell-style"
macros of Template Haskell?
- blasdel 17y agoOCaml comes with (and is implemented using) camlp4 -- it's an extraordinarily powerful "Pre-Processor-Pretty-Printer" that operates directly on a concrete syntax for the language. Classical Lisp macros are only 'cleaner' by cheating. Most of Template Haskell is about solving a different problem (A statically-type-checked meta-language for generating code that must be statically type-checked) -- and thus is pretty messy. It's still way cleaner than any of its predecessors (at least of the ones I've used).
- dons 17y agoYes, note also that Haskell itself is the Template Haskell metalanguage. I.e. Haskell programs use Haskell to modify their own AST at compile time, giving you arbitrary AST power.