gnu.lists.PairWithPosition.toString() truncates the list?

Per Bothner per@bothner.com
Tue May 20 04:20:00 GMT 2008


Ethan Herdrick wrote:
> The toString for gnu.lists.PairWithPosition truncates lists with more
> than ten elements.  Why?
> 
> #|kawa:1|# (*:toString '(1 2 3 4 5 6 7 8 9 10 11 12 13))
> |(1 2 3 4 5 6 7 8 9 10 ...)|

To avoid cycles or really long/deep lists.

toString isn't really suitable for "bulk" output - it's more suited
to debugging and similar things.  For example IDEs like NetBeans
display objects using toString.  We could hack toString so it
catches cycles (which would be desirable in itself), but listing
a really list is also awkward and wasteful.

Also, toString doesn't interact well with pretty-printing, or
other formatting.

Finally, toString is very inefficient for creating output from
nested data structures such as lists, because if the need to
copy and concatenate strings.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list