[Issue 19530] New: New proposed syntax for mixins
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 31 05:09:17 UTC 2018
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 at puremagic.com
Reporter: porton at 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);
}
--
More information about the Digitalmars-d-bugs
mailing list