[Issue 8965] New: Implement mixin template for forwading constructors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 5 20:50:41 PST 2012
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: nobody at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 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: -------
More information about the Digitalmars-d-bugs
mailing list