[Issue 20053] New: mixin doesn't work for many expressions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 15 03:25:46 UTC 2019


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

          Issue ID: 20053
           Summary: mixin doesn't work for many expressions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com

Lots of expressions don't work as mixin, and you need to expand the mixin to
include the whole statement as a workaround.

Eg, doesn't work:
  alias impl = mixin("Thing." ~ fieldName); // ERROR

Ugly workaround:
  mixin("alias impl = Thing." ~ fieldName ~ ";");

This really inhibits readability when the code is even remotely complex.
I run into endless examples like this regularly. We can do better than this.

--


More information about the Digitalmars-d-bugs mailing list