toString not working... (a bug in D?)
Marcin Kuszczak
aarti at interia.pl
Mon Jan 15 12:05:14 PST 2007
Orgoton wrote:
> Ok, now I did
>
> import std.string;
> ushort number=1092;
> char[] text="Some text " ~ toString(number);
>
> and the compiler claimed that the number of arguments of
> Object.object.toString() did not match... So, I did
>
> char[] text="Some text " ~ std.string.toString(number);
>
> and it worked fine. Is this a compiler bug? I did not import object (as it
> is implicitly done). Or have I some weird compiler configuration?
Probably you did:
char[] text="Some text " ~ toString(number);
in class method, so compiler thought you want to refer to Object's
toString() method.
You should escape current scope of class with '.' (dot).
class Test {
void method(int number) {
char[] text="Some text " ~ .toString(number);
}
}
Above code should work.
--
Regards
Marcin Kuszczak (Aarti_pl)
-------------------------------------
Ask me why I believe in Jesus - http://zapytaj.dlajezusa.pl (en/pl)
Doost (port of few Boost libraries) - http://www.dsource.org/projects/doost/
-------------------------------------
More information about the Digitalmars-d
mailing list