www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17549] New: $($1) should expand to the macro identified by $1

https://issues.dlang.org/show_bug.cgi?id=17549

          Issue ID: 17549
           Summary: $($1) should expand to the macro identified by $1
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ddoc
          Severity: enhancement
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

Given a DDoc file:

// test.dd //
Ddoc

$(FOO BAR)

Macros:

BAR=bar
FOO=$($1)
/////////////

DMD will currently emit:

$(BAR)

This result is not what was intended, and not useful.

Allowing specifying and expanding macros by their name via macro parameters
would allow using new DDoc patterns, similar to the X macro preprocessor
pattern in C.

Example use case:

https://github.com/dlang/dlang.org/pull/1766#discussion_r123892968

--
Jun 25