What are AST Macros?
bearophile
bearophileHUGS at lycos.com
Mon Jul 12 16:50:42 PDT 2010
Andrei Alexandrescu:
> Back on topic: http://www.apl.jhu.edu/~hall/Lisp-Notes/Macros.html.
> Compare the simple macro in the beginning and the correct macro at the end.
CLisp macros are messy, they can be not easy to read and understand, and worse of all they can fragment the community because every large program that defines many complex macros essentially defines a new variety of CLisp. This makes it hard to read, modify and reuse for other purposes CLisp code written by other people (but allows the creation of domain-specific code, that can reduce program size and make it simpler). Python has refused macros mostly because of this risk of fragmentation. A significant part of the success of Python comes from the ecosystem of tons of little modules that you can download and use in your code with usually only little effort. A large usage of macros can kill this.
On the other hand I believe that D string mixins, if used to replace some of the purposes of CLisp macros, are worse than CLisp macros.
Scheme (and maybe Clojure too) macros are more hygienic so they remove some of the problems shown in that Macros.html page, this means that a good Square macro written in Scheme looks better and is simpler than that CLips one (on the other hand Scheme macros can be a little less powerful, I am not expert enough to give you examples).
Bye,
bearophile
More information about the Digitalmars-d
mailing list