www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8965] New: Implement mixin template for forwading constructors

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



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: -------
Nov 05 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8965


Peter Alexander <peter.alexander.au gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |peter.alexander.au gmail.co
                   |                            |m
         Resolution|                            |DUPLICATE



09:57:24 PST ---
Duplicates your more recent enhancement request. Marking this one as dup
because the more recent one has a possible implementation.

*** This issue has been marked as a duplicate of issue 9066 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 31 2012