Hi All,
I've noticed the following strange behavior in Lucid CLOS. When an
accessor is defined for a class allocation field, this accessor method
is redefined when I specify a method with the same name on a sibling
class. That sounds complicated, but the problem is quite simple and
is illustrated by the following code:
(defgeneric field (x))
(defclass class1 ()
((field :allocation :class :initform 4 :accessor field)))
(defclass class2 (class1)
((field :allocation :class :initform 10 :accessor field)))
(defclass class3 (class1)
())
(defmethod field ((x class3))
88)
After the following definitions are entered, (field (make-instance 'class2))
returns NIL, even though (slot-value (make-instance 'class2) 'field)
is 10. I believe both should return 10. Can people with access to
other CLOS implementations tell me how they handle this example? Is
this a bug with Lucid's CLOS implementation, or with my understanding
of CLOS? Note that if I leave out the method definition for
class3, (field (make-instance 'class2)) returns 10 as expected.
Thanks,
David
--
----------------------------------
David Kurlander Department of Computer Science
···@cs.columbia.edu Columbia University
In article <····················@cs.columbia.edu> ···@cs.columbia.edu (David Kurlander) writes:
>I've noticed the following strange behavior in Lucid CLOS. When an
>accessor is defined for a class allocation field, this accessor method
>is redefined when I specify a method with the same name on a sibling
>class.
Seems like a bug to me. I tried it in Symbolics Genera 8.0.1 and got the
expected answer. But I verified the bug in Lucid 4.0.1 with patches to
bugs 5565, 5557, and 5569 loaded.
--
Barry Margolin, Thinking Machines Corp.
······@think.com
{uunet,harvard}!think!barmar
In article <····················@cs.columbia.edu>, ···@cs.columbia.edu (David Kurlander) writes:
> I've noticed the following strange behavior in Lucid CLOS. When an
> accessor is defined for a class allocation field, this accessor method
> is redefined when I specify a method with the same name on a sibling
> class. That sounds complicated, but the problem is quite simple and
> is illustrated by the following code:
I tried your examples on Macintosh Common Lisp 2.0b1p3 and got the
expected results.
? (field (make-instance 'class2))
10
? (field (make-instance 'class1))
4
? (field (make-instance 'class3))
88