System programming in D (Was: The God Language)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Dec 30 16:10:44 PST 2011


On 12/30/11 5:21 PM, Timon Gehr wrote:
> On 12/31/2011 12:02 AM, Andrei Alexandrescu wrote:
>> The library has a simple interface:
>>
>> enum myMacro = q{... $1 $2 $(anotherMacro($1))... };
>>
>> // To mixin
>> mixin(expand(myMacro, "argument one", "argument two"));
>>
>>
>> Andrei
>>
> I understand, but compared to how I solved the issue
>
> 1. it invents an (arguably inferior) parameter passing system, even
> though there is one in the language.
> 2. it picks up all symbols used in $(...) from the caller's context
> rather than the callee's context and there is no way to get rid of that
> default, because the macro is unscoped.

Fair enough. I think your idea of defining a mini-macro-expansion system 
based on CTFE and strings is genius. I also think at the present the 
semantics are very unprincipled, and should not be popularized in any 
form lest D mixins acquire reputation similar to C macros. Finally, I 
think you have the resources to work your idea into a wonderful system 
that will be principled, practical, and extremely powerful.

Good luck!

Andrei


More information about the Digitalmars-d mailing list