Tim Bradshaw <t...@tfeb.org> writes: > On 2007-03-06 14:05:59 +0000, Richard M Kreuter <kreu...@progn.net> said:
>> If the PRINT emits output with a custom read macro, then the READ will >> error, since WITH-STANDARD-IO-SYNTAX uses the standard readtable.
> Yes. If you want a special readtable in place but otherwise want to be > assured of standard syntax you need to put stuff inside > WITH-STANDARD-IO-SYNTAX to make that be the case.
Well sure, you can use WITH-STANDARD-IO-SYNTAX as a base on which to build custom I/O syntaxes.
I was looking that the examples in the WITH-STANDARD-IO-SYNTAX dictionary entry as constraints on what PRINT-OBJECT methods can do, since the examples won't work in general if PRINT-OBJECT methods can emit arbitrary output,
Now that I look at it, the dictionary entry for *PRINT-READABLY* is clear enough on its own:
| If ‘*print-readably*’ is true, some special rules for printing | objects go into effect. Specifically, printing any object O₁ | produces a printed representation that, when seen by the Lisp reader | while the standard readtable is in effect, will produce an object O₂ | that is similar to O₁.
So a PRINT-OBJECT method /must not/ emit anything unreadable in the standard syntax when *PRINT-READABLY* is true. Provided that all methods PRINT-OBJECT conform to this protocol WITH-STANDARD-IO-SYNTAX turns out to be reliable, after all.