stringof Bug?
Janice Caron
caron800 at googlemail.com
Fri Oct 19 04:57:51 PDT 2007
Do we count this as a bug, or not?
class T(int N)
{
}
writefln(T!(1).stringof);
This writes "T", not "T!(1)".
This might seem trivial, but it took me hours to debug a problem I
had, whereby I was passing a load of type names into a mixin and then
using stringof to turn that input into valid D code, so of course when
I did
mixin M(T!(1));
it all fell over. The error message was something like "class T(int)
used as a type", and the location of the error was deep inside the
mixin. After much aggravation, I found the workaround, which was was
to do
class A : T!(1) {}
mixin M(A);
So, is that a real bug, or are my expectations just too high?
More information about the Digitalmars-d
mailing list