Wilfred Hughes on Macro Systems

Wilfred Hughes has an interesting post, Comparitive Macrology, in which he looks at the macro systems of various languages. For each, he implements two macros:

  • A swap macro to exercise hygiene
  • An anaphoric macro to exercise (intentional) variable capture

He demonstrates the advantages and disadvantages of each language's macro system.

Hughes starts with C, moves on to Common Lisp, New Lisp, Scheme, Clojure, sweet.js, Rust, and Julia. It's a really interesting post and well worth reading.

One of the things that struck me was how ugly the syntax of the non-Common Lisp languages are. Even Scheme, which shares most of its syntax with Common Lisp has a really ugly macro language. That's something worth remembering the next time non-Lispers start grousing about all those parentheses. Just refer them to the syntax of their language.

UPDATE: Wilford → Wilfred

This entry was posted in Programming and tagged . Bookmark the permalink.
  • I'm sure you meant Wilfred. :-)

    • jcs

      Sigh. I did indeed. Fixed. Thanks. The miracle is that I haven't yet managed to mangle your handle.

      • Yes, that's impressive!
        Between Arthur-without-an-H and a relatively complex last name, people mistype my name more often than not.