Printer that prints readably when readtable is c-c-r-m
The symbol :|[| does not print readably when the readtable is c-c-r-m. Add functionality to fix this, and any other incompatibility between reading and printing. Ideally, this should be specified along with the readtable, and be composable like readtables. This may require update to named-readtables. There is unfortunately no standard way to merge pprint dispatch tables.
Can you provide a minimal example of what is going wrong currently and how you would like to see it behave?
Example:
(defpackage :example
(:use :cl :named-readtables :curry-compose-reader-macros))
(in-package :example)
(defun round-trip (e)
(let ((*package* (find-package :example))
(*readtable* (find-readtable :curry-compose-reader-macros)))
(read-from-string (with-output-to-string (s)
(format s "~s" e)))))
;; (round-trip :|[|) ==> reader error
I don't know if there is a portable way to do this. The problem is that the lisp printer isn't escaping [.
EXAMPLE> (prin1 '|(|)
|(|
|(|
EXAMPLE> (prin1 '|[|)
[
[
Looking into SBCL's implementation there is a note in the implementation of output-symbol which says
;; Hmm. Should these depend on what characters
;; are actually escapes in the readtable ?
;; (See similar remark at DEFUN QUOTE-STRING)
and the decision is ultimately made by the symbol-quotep function.