The general transcript of a Scheme session will also include strings
printed with `display`,

Yes

so the formatter already has to do some
guesswork without #<...> objects.  The job isn't much harder when
#<...> is added, I think, because the cases where the closing > is
ambiguous are rare.

I've worked with code formatters a lot. Making them do guesswork about syntax means something is badly wrong in the design. Formatters should work with "write output", not "display output".

That said, John's suggestion to use #<"..."> solves the point you
brought up, although when working at the REPL (where an informal
output is enough), something like #<procedure car> is a bit more
pleasant than #<"procedure car">.

#<"string"> is heading in the direction of Unix where syntax and parsing tends to be ad hoc. We should go in the opposite direction, of Lisp, where the trend is for all data to be structured and uniform.

SRFI 176 has already delivered on this front. We should do more. I'll write that essay, "Taking S-expressions seriously", in due course.

Reply via email to