AST Macros?

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 1 08:38:19 PDT 2012


On Friday, June 01, 2012 17:57:51 d coder wrote:
> Greetings
> 
> I know there is a plan for D to have AST macros eventually. I wanted to
> know if it is a feature being worked upon at this point of time.
> Approximately how long it would be before AST Macros see the light of the
> day in D?
> 
> I know D is an opensource project and I am not trying to put any pressure
> here. I am just curious because I think D is a great language for creating
> DSL's and having AST Macros will make a big difference.

There was talk of doing AST macros quite while back, but it was decided not to 
add them to D2. They may or may not ever be revisited. This page isn't 
necessarily completely up-to-date ( 
http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel ), but it specifically lists 2 
things as deferred to D3.0:

* AST macros.
* Bartosz Milewski's race-free type system.

String mixins should be powerful enough in most, if not all, cases. It's been 
shown that it's quite possible to create DSLs as strings with whatever syntax 
you want and have them compiled to D code (Philippe Segaud put together a 
really cool library for generating PEGs: 
https://github.com/PhilippeSigaud/Pegged/wiki ).

We _may_ see AST macros added to the language in the distant future, but it's 
not happening anytime soon.

- Jonathan M Davis


More information about the Digitalmars-d mailing list