System programming in D (Was: The God Language)

Walter Bright newshound2 at digitalmars.com
Fri Dec 30 20:19:47 PST 2011


On 12/30/2011 8:02 PM, Timon Gehr wrote:
> On 12/31/2011 04:50 AM, Walter Bright wrote:
>> Because inevitably someone will write:
>>
>> #define FOO a + FOO
>>
>> and expect it to work (the correct expansion would be "a + FOO", not a
>> stack overflow). The C preprocessor works this way, as do makefile
>> macros, as Ddoc does.
>
> Makes sense, but why is it an issue if expansion is explicit?
>
> enum FOO = q{a + FOO};
>
> mixin(FOO);

Because the expanded text is then rescanned for further macro replacement.



More information about the Digitalmars-d mailing list