Bug 19292 – Mixin expressions should take an argument list the same as pragma(msg) does

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-10-08T03:08:12Z
Last change time
2021-04-02T05:45:23Z
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2018-10-08T03:08:12Z
Mixin expressions are currently limited to being strings: https://dlang.org/spec/expression.html#mixin_expressions While they should accept what the more flexible pragma(msg) does: https://dlang.org/spec/pragma.html#msg This will make more complex mixin expressions easier to write without depending on Phobos for formatting, and will run faster and require less memory for CTFE to evaluate.
Comment #1 by bugzilla — 2018-10-08T03:10:03Z
Test case: int test() { return mixin("1", 2); } void testit() { static assert(test() == 12); }
Comment #2 by bugzilla — 2018-10-08T04:52:46Z
Comment #3 by github-bugzilla — 2018-10-08T05:55:07Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/13a3a7141ef3eafab2f2c588d488bd109156d8f8 fix Issue 19292 - Mixin expressions should take an argument list the same as pragma(msg) does https://github.com/dlang/dmd/commit/93698003bd2d5c3299e13410f8f001031c36c88b Merge pull request #8808 from WalterBright/fix19192 fix Issue 19292 - Mixin expressions should take an argument list the …
Comment #4 by bugzilla — 2018-10-08T07:09:52Z
Comment #5 by bugzilla — 2018-10-09T01:15:44Z
Comment #6 by github-bugzilla — 2018-10-09T03:04:08Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/95133cf592c8415c4b28b8193e09f4c933a00178 fix Issue 19292 - Mixin expressions should take an argument list the same as pragma(msg) does https://github.com/dlang/dmd/commit/2b68951f210e003ed447f482ebb41b7d134e4045 Merge pull request #8809 from WalterBright/fix19292-2 fix Issue 19292 part 2 - Mixin statements should take an argument list the …
Comment #7 by github-bugzilla — 2018-10-13T10:41:51Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/51b5d2197721d8d5c3f8057da4c28ffa861bcab6 fix Issue 19292 part 3 - Mixin Declarations https://github.com/dlang/dmd/commit/4ecb04ba590f543927365d53d2e1d274b9333e4d Merge pull request #8813 from WalterBright/fix19292-3 fix Issue 19292 part 3 - Mixin Declarations
Comment #8 by github-bugzilla — 2018-10-14T03:32:28Z
Commit pushed to master at https://github.com/dlang/dlang.org https://github.com/dlang/dlang.org/commit/2b1e8ce197ad2f0adb7454b270a811ea41f0942b Merge pull request #2485 from WalterBright/mixin-args fix Issue 19292 - Mixin expressions should take an argument list
Comment #9 by Marco.Leise — 2018-11-02T03:18:54Z
I like it! Really pargma-tic and will optimize many uses of mixin.
Comment #10 by default_357-line — 2020-01-20T11:23:48Z
Why does this allow evaluating types as their stringof? That may be fine for a debug tool like pragma(msg, but it's horrible for a mixin because it does the very, very wrong thing. Ie. if you have a template with a parameter T instantiated with int, then if you decide to use it as a mixin argument, you'll get "int", not "T" - which is fine, but rapidly becomes not fine when it's a private type in another module.
Comment #11 by dlang-bot — 2021-04-02T05:45:23Z
dlang/dmd pull request #12339 "[dmd-cxx] Backport fixes and trivial features from upstream dmd" was merged into dmd-cxx: - 4cf3e2c00b7f7d636f50290db49efe618698d5c2 by Walter Bright: [dmd-cxx] fix Issue 19292 - Mixin expressions should take an argument list the same as pragma(msg) does https://github.com/dlang/dmd/pull/12339