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: [email protected]
          Reporter: [email protected]

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);
}

--

Reply via email to