Haskell has macros, they are just less prominent than in Lisps.
There's even multiple approaches to macros in Haskell. One of them is template Haskell.
Haskell has macros, they are just less prominent than in Lisps.
There's even multiple approaches to macros in Haskell. One of them is template Haskell.
I am most familiar with Scheme (and Racket) and Common Lisp. Could you explain how 'runtime macros' work in any of these systems? Perhaps give some example code?
Similarly to how the C preprocessor doesn't use C as its 'scripting language' but some weird unholy concoction.
But that doesn't have much to do with being dynamic or 'runtime'. You could hack up a pre-processor for C that uses C. (It just would be unwieldy.)
Btw, many Lisps are compiled. I don't think `eval` is necessary to make a Lisp; but it is indeed rather common.
(To be fair, Python's 'eval' operates on strings, Lisp likes its eval to operate on something much more (but not quite) like abstract syntax trees. But it would be relatively straightforward to make a version of Python that uses s-expressions and has an eval that works on them; without changing anything else about the language.)
Apart from matters of parsing, being able to build elegant circular-meta-interpreters isn't too hard nor special, if your language is reasonably simple but still has enough functional programming features.
Homoiconicity is fun, but it's not a very deep property of your favourite language.
See https://github.com/eratosthenesia/lispc for someone making a C with s-expression syntax.
You can do that in Haskell, too, but it's much, much less common.