AST macros

Sean Kelly sean at f4.ca
Sat Mar 17 07:36:10 PDT 2007


Walter Bright wrote:
> 
> macros should be the final piece needed to make DSL's work nicely, and 
> they are actually rather simple conceptually and implementation-wise. I 
> tried for a long time to figure out how to make templates do the work, 
> until I finally realized that AST macros are *fundamentally different* 
> from templates.

Yup.  It sounds like the implementation will really be quite like the 
new mixin feature wrapped in some syntactic sugar.  Oddly, I'm actually 
looking forward to this.  There have been a few instances where I 
actually needed macros... some being cases where I wanted to define a 
local template function (which is illegal), and others for more bizarre 
uses.

> A nice side benefit to macros is we should be able to deprecate lazy.

I actually like 'lazy' for a narrow range of uses.  It makes creating an 
optimal debug logger exceedingly simple, for example.  Compared to all 
the evil tricks Matthew needed for Pantheios, 'lazy' has a clear and 
measurable benefit.  But if the same thing could be accomplished using 
macros then so much the better.


Sean



More information about the Digitalmars-d mailing list