recursing ddoc macros two arguments at a time
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 16 16:11:40 PST 2015
I thought this isn't possible: http://goo.gl/QTAUFb. This:
$(TOCENTRY comparison.html, D Feature List)
$(TOCENTRY builtin.html, Rationale for Builtins)
$(TOCENTRY ctod.html, Converting C to D)
$(TOCENTRY cpptod.html, Converting C++ to D)
$(TOCENTRY pretod.html, The C Preprocessor vs D)
$(TOCENTRY cppcontracts.html, D Contract Programming vs C++)
can be simplified to this:
$(TOCENTRIES
comparison, D Feature List,
builtin, Rationale for Builtins,
ctod, Converting C to D,
cpptod, Converting C++ to D,
pretod, The C Preprocessor vs D,
cppcontracts, D Contract Programming vs C++
)
(The .html elimination is a minor detail.)
The trick is to recurse twice using $+ every time:
TOCENTRIES=$(TOCENTRY $1, $2) $(TOCENTRIES_REC $+)
TOCENTRIES_REC=$(TOCENTRIES $+)
Thought this is worth sharing. We could simplify a few more things with
this.
Andrei
More information about the Digitalmars-d
mailing list