digitalmars.D.bugs - [Issue 1462] New: Templated constructor not supported
- d-bugmail puremagic.com (20/20) Aug 31 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1462
- d-bugmail puremagic.com (23/23) Sep 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1462
- Jarrett Billingsley (3/26) Sep 09 2008 I think it's much more that templated methods cannot be virtual, and
- Denis Koroskin (3/46) Sep 09 2008 How about struct constructors?
- Sean Kelly (3/6) Sep 09 2008 How are constructors virtual?
- Jarrett Billingsley (5/10) Sep 09 2008 Uhh umm
- Bruno Medeiros (9/20) Sep 11 2008 That makes no sense :p . Not only are they not virtual, they could never...
- Jarrett Billingsley (3/24) Sep 11 2008 Then beat Walter over the head!
- Bruno Medeiros (5/25) Sep 15 2008 Apparently my cluebat doesn't reach all the way to Seattle! -_-'
- d-bugmail puremagic.com (12/12) Aug 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1462
http://d.puremagic.com/issues/show_bug.cgi?id=1462 Summary: Templated constructor not supported Product: D Version: 2.003 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: reiner.pope gmail.com I know of no way to create a templated constructor for a class. (This is useful, for instance, with variadic template args). The following code fails to parse in compilation: class Foo { this(T...)(T t) {} } --
Aug 31 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1462 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Severity|normal |enhancement Keywords| |spec ------- Comment #1 from smjg iname.com 2008-09-09 12:32 ------- The problem seems to be that the current D syntax doesn't support it: Constructor: this Parameters FunctionBody Parameters: ( ParameterList ) ( ) The alternative would be class Foo { template(T...) this { this(T t) {} } } except that this doesn't work because 'this' is a keyword, not an identifier. --
Sep 09 2008
On Tue, Sep 9, 2008 at 1:32 PM, <d-bugmail puremagic.com> wrote:http://d.puremagic.com/issues/show_bug.cgi?id=1462 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Severity|normal |enhancement Keywords| |spec ------- Comment #1 from smjg iname.com 2008-09-09 12:32 ------- The problem seems to be that the current D syntax doesn't support it: Constructor: this Parameters FunctionBody Parameters: ( ParameterList ) ( ) The alternative would be class Foo { template(T...) this { this(T t) {} } } except that this doesn't work because 'this' is a keyword, not an identifier. --I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.
Sep 09 2008
On Tue, 09 Sep 2008 22:48:01 +0400, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:On Tue, Sep 9, 2008 at 1:32 PM, <d-bugmail puremagic.com> wrote:How about struct constructors?http://d.puremagic.com/issues/show_bug.cgi?id=1462 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Severity|normal |enhancement Keywords| |spec ------- Comment #1 from smjg iname.com 2008-09-09 12:32 ------- The problem seems to be that the current D syntax doesn't support it: Constructor: this Parameters FunctionBody Parameters: ( ParameterList ) ( ) The alternative would be class Foo { template(T...) this { this(T t) {} } } except that this doesn't work because 'this' is a keyword, not an identifier. --I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.
Sep 09 2008
Jarrett Billingsley wrote:I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.How are constructors virtual? Sean
Sep 09 2008
On Tue, Sep 9, 2008 at 3:55 PM, Sean Kelly <sean invisibleduck.org> wrote:Jarrett Billingsley wrote:Uhh umm Well as it is now, constructors are treated as methods of the class, so they participate in overloading. But I think you're right - it doesn't really seem to have to be that way.I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.How are constructors virtual?
Sep 09 2008
Jarrett Billingsley wrote:On Tue, Sep 9, 2008 at 3:55 PM, Sean Kelly <sean invisibleduck.org> wrote:That makes no sense :p . Not only are they not virtual, they could never be virtual. Virtual method dispatch is used when you have polymorphism and don't know the exact class of the receiving object. But when constructing you always know the exact class being creating, so you would always know which method/constructor/whatever to dispatch to. -- Bruno Medeiros - Software Developer, MSc. in CS/E graduate http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DJarrett Billingsley wrote:Uhh umm Well as it is now, constructors are treated as methods of the class, so they participate in overloading. But I think you're right - it doesn't really seem to have to be that way.I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.How are constructors virtual?
Sep 11 2008
On Thu, Sep 11, 2008 at 5:53 AM, Bruno Medeiros <brunodomedeiros+spam com.gmail> wrote:Jarrett Billingsley wrote:Then beat Walter over the head!On Tue, Sep 9, 2008 at 3:55 PM, Sean Kelly <sean invisibleduck.org> wrote:That makes no sense :p . Not only are they not virtual, they could never be virtual. Virtual method dispatch is used when you have polymorphism and don't know the exact class of the receiving object. But when constructing you always know the exact class being creating, so you would always know which method/constructor/whatever to dispatch to.Jarrett Billingsley wrote:Uhh umm Well as it is now, constructors are treated as methods of the class, so they participate in overloading. But I think you're right - it doesn't really seem to have to be that way.I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.How are constructors virtual?
Sep 11 2008
Jarrett Billingsley wrote:On Thu, Sep 11, 2008 at 5:53 AM, Bruno Medeiros <brunodomedeiros+spam com.gmail> wrote:Apparently my cluebat doesn't reach all the way to Seattle! -_-' -- Bruno Medeiros - Software Developer, MSc. in CS/E graduate http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DJarrett Billingsley wrote:Then beat Walter over the head!On Tue, Sep 9, 2008 at 3:55 PM, Sean Kelly <sean invisibleduck.org> wrote:That makes no sense :p . Not only are they not virtual, they could never be virtual. Virtual method dispatch is used when you have polymorphism and don't know the exact class of the receiving object. But when constructing you always know the exact class being creating, so you would always know which method/constructor/whatever to dispatch to.Jarrett Billingsley wrote:Uhh umm Well as it is now, constructors are treated as methods of the class, so they participate in overloading. But I think you're right - it doesn't really seem to have to be that way.I think it's much more that templated methods cannot be virtual, and constructors more or less have to be.How are constructors virtual?
Sep 15 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1462 Steven Schveighoffer <schveiguy yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |schveiguy yahoo.com Resolution| |DUPLICATE --- Comment #2 from Steven Schveighoffer <schveiguy yahoo.com> 2010-08-05 10:57:21 PDT --- *** This issue has been marked as a duplicate of issue 435 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 05 2010