http://d.puremagic.com/issues/show_bug.cgi?id=8965
Summary: Implement mixin template for forwading constructors
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 2012-11-05
20:50:40 PST ---
The syntax should be a simple as doing 'mixin Forward' in a class. This would
alleviate the pain of having to duplicate code just to forward to base class
constructors. Hardcoded example:
import std.stdio;
mixin template Forward()
{
this(int x) { super(x); }
}
class Foo
{
this(int i) { writeln(i); }
}
class Bar : Foo
{
mixin Forward;
}
void main()
{
auto bar = new Bar(1);
}
It should be relatively easy to implement.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------