From: SourceForge.net <no...@so...> - 2006-07-27 19:59:38
|
Bugs item #1482533, was opened at 2006-05-05 10:34 Message generated for change (Comment added) made by sds You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=1482533&group_id=1355 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: clisp Group: ANSI compliance issue >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Jörg Höhle (hoehle) >Assigned to: Sam Steingold (sds) Summary: print-object built-in object: no-applicable-method Initial Comment: CLHS says about PRINT-OBJECT: "Each implementation is required to provide a method on the class standard- object and on the class structure-object. In addition, each implementation must provide methods on enough other classes so as to ensure that there is always an applicable method." Contrary to this, print-object signals a NO-APPLICABLE- METHOD: (print-object 2 *standard-output*) *** - NO-APPLICABLE-METHOD: When calling #<STANDARD-GENERIC-FUNCTION PRINT-OBJECT> with arguments (2 #<IO SYNONYM-STREAM *TERMINAL- IO*>), no method is applicable. I came across this trying out the CLHS example about pprint dispatch tables: (set-pprint-dispatch '(cons (member my-let)) (pprint-dispatch '(let) nil)) With NO-APPLICABLE-METHOD, the following identity mentioned abour PPRINT-DISPATCH does not hold: (let ((*print-pretty* t)) (write object :stream s)) == (funcall (pprint-dispatch object) s object) because pprint-dispatch defers to PRINT-OBJECT which errors out. Regards, Jörg Höhle ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2006-07-27 15:59 Message: Logged In: YES user_id=5735 thank you for your bug report. the bug has been fixed in the CVS tree. you can either wait for the next release (recommended) or check out the current CVS tree (see http://clisp.cons.org) and build CLISP from the sources (be advised that between releases the CVS tree is very unstable and may not even build on your platform). ---------------------------------------------------------------------- Comment By: Sam Steingold (sds) Date: 2006-07-27 11:30 Message: Logged In: YES user_id=5735 instead of tediously writing a defmethod for each and every built-in class, I would rather have something like (defconstant print-object-methods-<instance-of-built-in-class> (list (defmethod print-object (obj (out stream)) (write obj :stream out)))) (remove-method #'print-object (first print-object-methods-<instance-of-built-in-class>)) (defmethod compute-applicable-methods-using-classes ((gf (eql #'print-object)) args) (multiple-value-bind (l p) (call-next-method) (if (and (null l) (eq (class-of (first args)) <built-in-class>) (eq (second args) <stream>)) (values print-object-methods-<instance-of-built-in-class> t) (values l p)))) alas, this causes a stack overflow in bootstrap and has no effect when type at the prompt. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=1482533&group_id=1355 |