digitalmars.D.learn - template class name unconsistent behavior
- timotheecour (21/21) Sep 16 2012 Is that a bug?
- timotheecour (4/4) Sep 16 2012 If this behavior is not a bug, I wonder what's the rationale, but
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (9/30) Sep 16 2012 This bug must be related:
- timotheecour (1/1) Sep 16 2012 done: http://d.puremagic.com/issues/show_bug.cgi?id=8674
Is that a bug? The code below returns: "main.A!(double).A" if we uncomment "auto c=make!A(1.0);", we get: "main.a!(double).A" ---- module main; import std.stdio; class A(T){ T x; this(T x){this.x=x;} } auto make(alias a,T...)(T args){ return new a!T(args); } void main(){ //auto c=make!A(1.0); auto b=new A!double(1.0); writeln(typeid(b)); } ----
Sep 16 2012
If this behavior is not a bug, I wonder what's the rationale, but also, how can we have such a "make" function that doesn't mess up the template class name depending on the order of which is used first (the make!T variant or the new A!T) ?
Sep 16 2012
On 09/16/2012 05:08 PM, timotheecour wrote:Is that a bug? The code below returns: "main.A!(double).A" if we uncomment "auto c=make!A(1.0);", we get: "main.a!(double).A" ---- module main; import std.stdio; class A(T){ T x; this(T x){this.x=x;} } auto make(alias a,T...)(T args){ return new a!T(args); } void main(){ //auto c=make!A(1.0); auto b=new A!double(1.0); writeln(typeid(b)); } ----This bug must be related: http://d.puremagic.com/issues/show_bug.cgi?id=8579 Other bugs that are linked from that one mention an internal hash table. Apparently different objects resolve to the same key, and the value of the first key gets used from that hash table. I don't know whether Kenji Hara's fix for the bug above also fixed this issue. I say, open a bug anyway. Ali
Sep 16 2012
done: http://d.puremagic.com/issues/show_bug.cgi?id=8674
Sep 16 2012