gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] methods


From: Leo Butler
Subject: [Gcl-devel] methods
Date: Fri, 17 Jan 2014 01:33:43 GMT

Hi,

I don't understand the following behaviour.

>(defstruct w (a))

W

>(defmethod print-object ((w w) s) (format s "#s(w :a ~a) ;; w struct" (w-a w)))

#<Standard-Method PRINT-OBJECT (W T) 74054530>

>#s(w a 1)

#S(W A 1)

>(print-object * t)
#s(w :a 1) ;; w struct
NIL

My expectation is that the last 2 outputs should be the same. Why
aren't they? Note that

>(defclass v () (a))

#<Standard-Class V 74043170>

>(defmethod print-object ((v v) s) (format s "#s(v :a) ;; v class"))

#<Standard-Method PRINT-OBJECT (V T) 74042710>

>(make-instance 'v)

#s(v :a) ;; v class

Leo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]