www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19299] New: string mixins and template mixins should be

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 puremagic.com
          Reporter: simen.kjaras 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;
}

--
Oct 11 2018