[Issue 17549] New: $($1) should expand to the macro identified by $1

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 25 01:40:50 PDT 2017


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 at puremagic.com
          Reporter: dlang-bugzilla at 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

--


More information about the Digitalmars-d-bugs mailing list