digitalmars.D - recursing ddoc macros two arguments at a time
- Andrei Alexandrescu (23/23) Jan 16 2015 I thought this isn't possible: http://goo.gl/QTAUFb. This:
- Walter Bright (6/27) Jan 16 2015 Two thoughts:
- Andrei Alexandrescu (4/41) Jan 16 2015 Looks better on the page.
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
Jan 16 2015
On 1/16/2015 4:11 PM, Andrei Alexandrescu wrote: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.Two thoughts: 1. Need to add this to the Ddoc documentation! Or at least a tip sheet on Ddoc. 2. Why use url shorteners like http://goo.gl/QTAUFb ? I don't generally care to click on links that I have no idea where they go. Here's the real link: https://github.com/D-Programming-Language/dlang.org/pull/776/files#diff-582d0a2140b180aec5d08a9e6176399aR71
Jan 16 2015
On 1/16/15 6:39 PM, Walter Bright wrote:On 1/16/2015 4:11 PM, Andrei Alexandrescu wrote:Who wanna do that? Other good examples are ENUMERATE and ITEMIZE.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.Two thoughts: 1. Need to add this to the Ddoc documentation! Or at least a tip sheet on Ddoc.2. Why use url shorteners like http://goo.gl/QTAUFb ? I don't generally care to click on links that I have no idea where they go. Here's the real link: https://github.com/D-Programming-Language/dlang.org/pull/776/files#diff-582d0a2140b180aec5d08a9e6176399aR71Looks better on the page. Andrei
Jan 16 2015