Why does toString() exist? It seems useless.

Ary Borenszweig ary at esperanto.org.ar
Sun Aug 24 08:35:24 PDT 2008


Don a écrit :
> Leandro Lucarella wrote:
>> Don, el 18 de agosto a las 12:41 me escribiste:
>>> I cannot understand the rationale for a toString() member function 
>>> which doesn't support formatting.
>>
>> I think is useful only for debugging purposes.
> 
> I agree. Which means that having I/O functions call toString() is a 
> broken design (I'm looking at you, writefln!)

But... writefln is used a lot for debugging purposes. If you quickly 
want to print something to the console, it's much faster not having to 
use toString() everywhere.


More information about the Digitalmars-d-learn mailing list