December 31, 2018 [Issue 19530] New: New proposed syntax for mixins | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19530 Issue ID: 19530 Summary: New proposed syntax for mixins Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: porton@narod.ru The programmer sometimes needs to instantiate mixin templates with the same arguments repeatedly, like: mixin template A(int x, float y) { // ... } mixin template B(int x, float y) { // ... } I propose to shorten the above code with the following syntax: template composite(int x, float y) { mixin A { // ... } mixin B { // ... } } // ... struct Test { mixin composite(1, 2.0); } -- |
Copyright © 1999-2021 by the D Language Foundation