colour lib needs reviewers

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 15 04:06:53 PDT 2016


On 9/15/16 2:11 AM, Walter Bright wrote:
> On 9/14/2016 2:31 PM, Andrei Alexandrescu wrote:
>> The resulting look is alien too, as opposed to the more familiar
>> $MACRO(a1, a2,
>> a3) or the CPP-style MACRO(a1, a2, a3).
>
> The $(MACRO a1, a2, a3) syntax comes from makefiles.

In the words of Seinfeld, "And that doesn't help either!"

I was thinking more about it and figured we could introduce a special 
macro at the very beginning of a .ddoc file or "Macros:" section called 
DDOC_MACRO_CALL_SYNTAX. It may be defined one of the following:

DDOC_MACRO_CALL_SYNTAX = DDOC

That's today's syntax.

DDOC_MACRO_CALL_SYNTAX = CPP

A macro will be invoked as MACRO(a1, a2).

DDOC_MACRO_CALL_SYNTAX = $CPP

A macro will be invoked as $MACRO(a1, a2)

DDOC_MACRO_CALL_SYNTAX = LaTeX

Macro invocation is \MACRO{a1}{a2}.

This definition is modular, i.e. it doesn't carry beyond the current 
document (otherwise the semantics of a .dd file depends on the .ddoc 
file(s) it's used with).

Macro definitions stay the same using $1, $2 etc. but macros invoked by 
them would need to obey the DDOC_MACRO_CALL_SYNTAX defined at the top.

Thoughts?


Andrei



More information about the Digitalmars-d mailing list