On Wed, 07 Oct 2009 09:17:59 -0400, Jarrett Billingsley <jarrett.billings...@gmail.com> 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)

i.e.

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);}");
}

usage:

log.logError("bad error occurred with object: " ~ expensiveObjectStringification(obj));

No more lazy parameters, no more stupid delegates :)

-Steve

Reply via email to