[armedbear-devel] The purpose of the writeToString() method (before we can rename it to printObject() or anything else)

Erik Huelsmann ehuels at gmail.com
Sun Jul 17 18:40:52 UTC 2011

Today I thought I'd address ticket #160. That ticket is about %OUTPUT-OBJECT
(a primitive) checking the string returned for the non-readable "#<" marker.
The problem is that it'll raise a PRINT-NOT-READABLE error on any output
containing that marker, even if it's part the serialized presentation which
*is* readable, like the uninterned symbol #:|#<32|.

The solution I'm aiming at is to make every writeToString() method raise an
error when it can't return a readable representation when a readable
representation is requested.

In preparation of this change I'm investigating the uses of writeToString().
There are 213 occurrences of the string ".writeToString()", many of which
are related to the creation of error messages. It'd be particularly
impractical to generate errors while creating an error message. On the other
hand, there are also uses, such as the one by %OUTPUT-OBJECT which typically
*should* obey those values and generate the PRINT-NOT-READABLE error

So, simply renaming writeToString() to printObject() is still an option. We
can even make the printObject() functions check whether they are allowed to
return unreadable output. However, it seems to me we additionally need a
function which returns - optionally unreadable - output without generating
errors. I'm thinking of a function which resets the variables to the values
WITH-STANDARD-IO-SYNTAX except that it binds *PRINT-READABLY* to NIL. Maybe
that function should be called printUnreadableObject() or something alike.
I've also thought about renaming writeToString() to printObjectInternal()
and creating a new printObject(boolean requireReadable) which does the
required work if the argument is true.

Hmm. I hope the above is something people want to comment on. At least I've
tried to describe my findings so far. I'm interested to know what others


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20110717/168cbdbc/attachment.html>

More information about the armedbear-devel mailing list