System programming in D (Was: The God Language)

Timon Gehr timon.gehr at gmx.ch
Fri Dec 30 15:49:39 PST 2011


On 12/31/2011 12:34 AM, Walter Bright wrote:
> On 12/30/2011 3:21 PM, Timon Gehr wrote:
>> 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.
>
> That's characteristic of how macros work, and people want it that way.
> Otherwise, they'd use functions or templates.

I don't think that is true. It's an undesirable characteristic. I don't 
think it works well together with a module system. Note that I use 
arbitrary CTFE inside @(...). That can be correcting the case of an 
identifier or any implementation detail. I don't want to require any 
module that expands the macro to import those implementation details 
publicly. If I actually want to pick up identifiers from the caller's 
scope, that is easy: I just embed another X template instantiation.



More information about the Digitalmars-d mailing list