Semantics of toString

Justin Johansson no at spam.com
Tue Nov 10 03:59:49 PST 2009


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.
> 
> Since you are in the know and probably the biggest toString() hater around: 
> are there plans (or rejections thereof) to change toString() before D2 turns 
> gold? Seems to me it could break quite some code.
> 

I have a feeling (and I may well be wrong) that toString might be used in
relation to associative arrays.  I implemented an AA recently based upon
a struct key (I think).  Though I cannot remember the exact details I do
remember DMD saying something about toString not implemented and
so without thinking I gave the struct a toString and that kept DMD happy.
Since the code was throw-away I didn't bother to investigate.

Like I say, I cannot remember the details but others may recall some similar
experience.  For all I know it may be a case of RTFM?

beers,
Justin




More information about the Digitalmars-d mailing list