DLang Spec rewrite (?)

Walter Bright newshound2 at digitalmars.com
Sat May 25 22:53:16 PDT 2013


On 5/25/2013 9:59 PM, Borden wrote:
> On Sunday, 26 May 2013 at 04:57:12 UTC, Borden wrote:
>> On Sunday, 26 May 2013 at 04:30:46 UTC, Walter Bright wrote:
>>> Again, this is deliberate. Macros are set up so that the last one overrides
>>> all the previous ones, enabling a hierarchy of them using ddoc files. It's a
>>> simple form of 'inheritance'.
>>
>> And perhaps this point could be clarified (and, when I next attack the source
>> I'll test it). I have one.ddoc two.ddoc and src.dd. In src.dd, I use
>> $(MY_MACRO x). one.ddoc has the line MY_MACRO=<p>Called one on $1</p>;
>> two.ddoc has the line MY_MACRO=<p>Called two on $1</p>.
>>
>> So, I now run dmd -o- -D one.ddoc two.ddoc src.dd. What does src.html say?
>
> and by $1 I mean, of course, $0.

The lexically last definition of MY_MACRO is used.


More information about the Digitalmars-d mailing list