System programming in D (Was: The God Language)

Timon Gehr timon.gehr at gmx.ch
Fri Dec 30 16:25:40 PST 2011


On 12/31/2011 01:10 AM, Andrei Alexandrescu wrote:
> 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.

I think what you propose is a lot closer to C macros than what I already 
use. Therefore I don't understand what qualifies its semantics as 
unprincipled.

> 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

I'd be happy to extend the system, but currently I don't see it fall 
short any of the three requirements. Can you help me out?



More information about the Digitalmars-d mailing list