qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qexo-general] toString() on result from eval()


From: Per Bothner
Subject: Re: [Qexo-general] toString() on result from eval()
Date: Thu, 22 May 2003 12:41:15 -0700
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4b) Gecko/20030507

Alessandro Vernet wrote:

One would expect the toString() to return an XML fragment equivalent to the one returned using the XMLPrinter.

One might, but I think the current behavior works better.
Note that toString is used all the time for quickie debug
output and messages, so generating a large XML datum may be
too much output.   "The result should be a concise but
informative representation that is easy for a person to read."

Besides, why should XML output be the default.? The result
is an "infoset item" - i.e. an abstract set of data.  There
is no inherent reason toString should convert it to XML syntax
- a Scheme programmer might prefer a Scheme-like syntax, which
is more compact.

If you want nicely formatted output use a format object,
where you can control the format more specifically.
For example an XMLPrinter wrapped around a StringWriter.

I guess I could add a convenience method:
  public static String toString(Object data) { ... }
--
        --Per Bothner
address@hidden   http://per.bothner.com/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]