Worst Phobos documentation evar!

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 31 12:54:14 PST 2014


On 12/31/2014 11:59 AM, Anon wrote:
> Nor should you have to write (or read!) $(UL $(LI A) $(LI B) $(LI C)) to get a list.

You don't have to. You can write it as:

  $(LIST A, B, C)

or:

  $(LIST
    A,
    B,
    C
  )


Yes, there currently isn't a LIST macro by default, but you can write one:

   LISTX=$(LI $1) $(LISTX $+)
   LIST=$(UL $(LISTX $1, $+))


I very often write custom macros for a particular job at hand. It's very, very 
handy. For example, suppose I want to switch between a definition list and a 
table? I write a higher level macro, then switch its definition. I can use the 
"X Macro" technique. I can "comment out" a block. I can create "variables". For 
example, when the D source moved from svn to github, the macro in each source 
code file that linked to the repository just needed its definition changed. With 
markdown, I'd have had to have edited every file (what, are there a thousand 
files?). And so on.

   http://en.wikipedia.org/wiki/X_Macro


More information about the Digitalmars-d mailing list