Better printing of method objects.

Print method qualifiers.
For specializers, print class names, not class objects, and print eql specializers.

(defmethod m :around (a b (c (eql "10"))))
was

#<standard-method M (#<BUILT-IN-CLASS T> #<BUILT-IN-CLASS T>
                     #<CLOS:EQL-SPECIALIZER>)>
becomes
#<standard-method M :AROUND (T T (EQL "10"))>
This commit is contained in:
Stas Boukarev 2016-08-30 21:37:24 +03:00
parent 815f6f07ae
commit 5f0beddf69

View file

@ -199,12 +199,18 @@ printer and we should rather use MAKE-LOAD-FORM."
(defmethod print-object ((m standard-method) stream)
(print-unreadable-object (m stream :type t)
(format stream "~A ~A"
(let ((gf (method-generic-function m)))
(if gf
(generic-function-name gf)
'UNNAMED))
(method-specializers m)))
(format stream "~A ~{~S ~}~S"
(let ((gf (method-generic-function m)))
(if gf
(generic-function-name gf)
'UNNAMED))
(method-qualifiers m)
(loop for spec in (method-specializers m)
collect (cond ((and (classp spec)
(class-name spec)))
((typep spec 'eql-specializer)
`(eql ,(eql-specializer-object spec)))
(t spec)))))
m)
(defun ext::float-nan-string (x)