On 2016-09-16 01:53, Walter Bright wrote:
On 9/15/2016 4:06 AM, Andrei Alexandrescu wrote:
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:


That's today's syntax.


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

That will break every usage of function calling examples. (It works in
CPP because if MACRO is not a macro, the text is left unchanged. In
Ddoc, a non-existent macro is replaced by the empty string.)


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


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

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

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.

1. accept more than one syntax
2. have the first encountered usage set the mode

My biggest issue with the macros is not the syntax (I don't like that either) but it's that one needs to use them too much.

/Jacob Carlborg

Reply via email to