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

Don nospam at
Thu Oct 8 01:06:47 PDT 2009

Jarrett Billingsley wrote:
> On Wed, Oct 7, 2009 at 11:21 AM, Don <nospam at> wrote:
>> 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
>> simple:
>> 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
>> elegant.
> It'd be nice if they actually worked. is(typeof()) fails for *any*
> error, and it eats those errors too, so if your code fails to compile
> for some reason other than the one you're testing for, welp, good luck
> figuring that out. And don't even get me started on .stringof.
> Also, see my post on the "get template and its instantiation
> parameters" thread for my detailed opinion on them.
>> 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.
> I.. don't even know how to begin to respond to that.

Have you read the Nemerle extended macro tutorial? The compiler's 
internal structures are completely exposed. That's a hack.

More information about the Digitalmars-d-learn mailing list