[Issue 24678] New: mixin does not work with interpolated strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 24 12:04:07 UTC 2024


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

          Issue ID: 24678
           Summary: mixin does not work with interpolated strings
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: qs.il.paperinik at gmail.com

The following should work:
```d
const name = "x";
mixin(iq{int $(name) = 10;});
```

But it fails because `mixin` has no understanding of interpolated strings and
requires (among other alternatives) appending `.text` to every `i` string
literal, which requires a needless `import` and thus a dependency. String mixin
and interpolated strings are core-language features and those should work
together.

--


More information about the Digitalmars-d-bugs mailing list