Am 06.09.2011, 11:12 Uhr, schrieb Jacob Carlborg <d...@me.com>:
On 2011-09-05 20:37, Marco Leise wrote:
Am 05.09.2011, 19:51 Uhr, schrieb Sean Kelly <s...@invisibleduck.org>:
Right. Which is why I've suggested in the past that we may want to use
the serialization calls for toString.
I'm highly skeptical to say the least :). I know there are languages
that serialize solely through text representations of the data, like
JavaScript, but I've yet to see this mix work in a systems language.
What serialization calls do you refer to?
- Marco
If we ever get a serialization package in Phobos, Orange for example:
http://www.dsource.org/projects/orange
Ok I get the picture, but the details are vague.
- How are pointers printed? As a hex value or as the data they point to
(flat toString vs. deep toString). A serialization API typically follows
class references and pointers.
- What do you do with classes that in Java don't inherit the Serializable
interface. Thread.toString() for example should - in my eyes - print the
thread id or pointer and the thread name if available, maybe also the
thread group.
And that's why I keep repeating that toString() is different from
serialization. It can _assist_ if you know you just want to print all
members of a struct in their default representation (which is what you
often want), but not replace it. Maybe that is what Sean meant to say, but
I wanted to clarify that.