Why does toString() exist? It seems useless.
Christopher Wright
dhasenan at gmail.com
Fri Aug 22 17:01:53 PDT 2008
Leandro Lucarella wrote:
> Sean Kelly, el 22 de agosto a las 12:46 me escribiste:
>> My experience with Java suggests that toString is meant for debugging purposes
>> anyway. It's rare that an object will produce meaningful user-level output with
>> its toString method.
>
> I agree, I meant that D should do better. Like templates are for gurus in
> C++ and for people in D, formatting should be for people too in D (as
> opposed to C++ manipulators =).
I strongly favor library solutions over language solutions for this.
Even if there were a language solution, I would still want a library
solution so I could better enforce separation of concerns. Unless I want
to use dependency injection on my domain classes, which is an
Abomination unto Nuggan, or put complex formatting logic into them,
which is nearly as abhorrent.
More information about the Digitalmars-d-learn
mailing list