[Issue 19299] New: string mixins and template mixins should be allowed in function parameter list

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 11 07:29:57 UTC 2018


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

          Issue ID: 19299
           Summary: string mixins and template mixins should be allowed in
                    function parameter list
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: simen.kjaras at gmail.com

Inspired by https://forum.dlang.org/post/nqfvaruzbffqkzvpjakh@forum.dlang.org

It would be nice if phobos had a CopyParameters template, which copies both
parameter types and -names, such that this compiles:

void fun(int a, string s);

void gun(mixin CopyParameters!fun) {
    a = 3;
    s = "foo";
}

When I do this today, the error message says 'basic type expected, not mixin'.

The feature should for string mixins: void foo(mixin("int x")) {}
And for template mixins: void bar(mixin tmp!()) {}
template tmp() {
    int a;
}

--


More information about the Digitalmars-d-bugs mailing list