Semantics of toString
Don
nospam at nospam.com
Tue Nov 10 07:41:03 PST 2009
grauzone wrote:
> Don wrote:
>> Lutger wrote:
>>> Don wrote:
>>> ...
>>>> There is a definite use for such as thing. But the existing toString()
>>>> is much, much worse than useless. People think you can do something
>>>> with
>>>> it, but you can't.
>>>> eg, people have asked for BigInt to support toString(). That is an
>>>> over-my-dead-body.
>
> How are you supposed to print a BigInt then?
How are you supposed to print one with it? It doesn't help.
(The problem even more obvious if you consider BigFloat).
> Just put it into an "interface DebugOutput", remove Object.toString(),
> and be done with it. That interface could be defined in the same module
> as writefln or format, and its use will be clear.
BigInt is a struct, so it doesn't have interfaces.
More information about the Digitalmars-d
mailing list