logoalt Hacker News

antonvslast Monday at 4:10 AM1 replyview on HN

> None of the macro systems in those languages are really equivalent to lisp macros.

Sure, but we’d hardly expect equivalence in such different languages.

I’ve written macros in all the languages I’ve mentioned, as well as Scheme’s syntax-rules and syntax-case, and in practice I don’t see some big advantage of any of them.

What actual useful macros do you write in Lisp, that would also be useful in one of those other languages, but can’t be expressed by their macro systems? Not saying it’s not possible to come up with theoretical examples, but what’s going to actually impact a programmer in those languages?

> If you really want static typing, Lisp macros are powerful enough to implement a full ML type system in userspace as a library.

On the other side of the fence, using Camlp5 you can implement Lisp or Scheme syntax and have OCaml run it directly. I did a toy implementation of that for Scheme years ago using Camlp4. You could easily implement syntax-rules macros in that environment. I enjoy games like that, but I don’t see much impact for real-world programming.

I think Coalton is cool, but I think you start to run into the limitations of Lisp syntax. I’d rather use Haskell to write that kind of code, it’s more concise. And to quote Paul Graham, succinctness is power. (PG does not endorse this message!)


Replies

nathan_comptonlast Monday at 4:32 PM

In recent years the only macro I really find myself writing (if it isn't supported in the base language) is pattern matching. If a language has that then I feel there isn't much else use for macros.