How about macro == symbol for mixin statement? [was Re: Member functions C to D]

Steven Schveighoffer schveiguy at
Wed Oct 7 07:09:03 PDT 2009

On Wed, 07 Oct 2009 09:17:59 -0400, Jarrett Billingsley  
<jarrett.billingsley at> wrote:

> It's also insanely kludgy and ugly. Bleh.

If all a macro did was translate a scoped normal symbol to a mixin (or  
other macro) statement, would this take care of the ugliness? (would also  
be an insanely simple solution)


macro doit(x, y, z) mixin("x" ~ "y" ~ "z"); // allow easy syntax for  
quoting parameters, since mixins are all about stringification.

doit(a, b, c) => mixin("abc");

Another example, logging:

class Logger
   macro logError(msg) mixin("{if(this.level >= ERROR)  
logMessage(this.level.Error, msg);}");


log.logError("bad error occurred with object: " ~  

No more lazy parameters, no more stupid delegates :)


More information about the Digitalmars-d-learn mailing list