Commit 752ebd9e authored by Tobias C. Rittweiler's avatar Tobias C. Rittweiler

Add custom PRINT-OBJECT method for named readtables.

darcs-hash:20090828194241-f5546-2fe20c4bf47e1bf66f60ed82d0a770c0597bb2b3.gz
parent b80f87ba
......@@ -221,3 +221,21 @@
collect (cons subchar disp-fn)))
(error () nil))
(return (values t char fn disp? alist)))))))))
;;;; Specialized PRINT-OBJECT for named readtables.
;;; As per #19 in CLHS 11.1.2.1.2 defining a method for PRINT-OBJECT
;;; that specializes on READTABLE is actually forbidden. It's quite
;;; likely to work on most implementations, though.
;;; We don't need this on Allegro CL's as we hook into their
;;; named-readtable facility, and they provide such a method already.
#-allegro
(defmethod print-object :around ((rt readtable) stream)
(let ((name (readtable-name rt)))
(if name
(print-unreadable-object (rt stream :type nil :identity t)
(format stream "~A ~S" (string :named-readtable) name))
(call-next-method))))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment