[comp.lang.lisp] Object Lisp bug or feature?

sbc@wucs1.wustl.edu (Steve B Cousins) (01/07/89)

I just ran across this interesting bug/feature in object lisp
and figured I'd throw it out for comments.

Object lisp is an object-oriented programming paradigm implemented
in Coral Lisp on the Mac (and I don't know where else) which provides
many of the standard features of other lisp object systems.  One of
these is the ability to call the shadowed version of a function from
within the shadowing version.  To call the next most-specific version of
a function foo from within the definition of foo, you call the function
"usual-foo" with the original arguments.  At any time, I can get a
pointer to the object for whom this function is defined by calling (self).

One would think that if I print the value of (self) as the very first
thing I do inside an object function, I should see an object of the class
for which this function was defined (otherwise a different function,
specific to the class of the object being manipulated but with the same
name as this function would have been called).  But try the following
code:

(defobject foo)
(defobfun (f foo) ()
	(format t "I am ~a" (self)))

(defobject baz)
(setq bazer (oneof baz))

(defobject bar foo)
(defobfun (f bar) ()
	(ask bazer (usual-f)))

So a bar is a foo, and a baz is something completely different.  To me,
only foos and descendents of foo should ever be (self) in (f foo).  But
try this now:

? (ask (oneof bar) (f))
I am #<Object #203, a BAZ>
NIL

Does this seem counter-intuitive to you, or am I just not understanding?

Steve Cousins			sbc@wucs1.WUSTL.EDU
Washington University		"Looking forward to an efficient CLOS"