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

Don nospam at
Wed Oct 7 08:21:24 PDT 2009

Steven Schveighoffer wrote:
> On Wed, 07 Oct 2009 09:17:59 -0400, Jarrett Billingsley 
> <jarrett.billingsley at> wrote:
>> It's also insanely kludgy and ugly. Bleh.

Ugly, yes. Kludgy, I don't think so. It's only a syntax issue. The basic 
concept of passing meta-code to the compiler in the form of raw text is 

mixin() if you want to insert something into the parse step.
  is(typeof()) if you want to catch it again after the syntax pass.
  stringof if you want to catch it again after the semantic pass.

And that's all. The syntax is ugly, but the semantics are beautifully 

By contrast, something like Nemerle macros are a kludge. The idea of 
providing a 'hook' into the compiler is a horrible hack. It exposes all 
kinds of compiler internals. Yes, it has nicer syntax.

> 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 think that's where the majority of the ugliness comes from.

More information about the Digitalmars-d-learn mailing list