Can someone tell me whether this following assertion
should fail or not? The assertion fails in clisp 2.36 but
succeeds in sbcl 0.9.4.
(setf (fdefinition 'class-precedence-list)
(fdefinition
#+clisp 'clos::class-precedence-list
#+sbcl 'sb-mop::class-precedence-list))
(defclass a () ())
(defclass b () ())
(defclass c (b) ())
(defclass b (a) ())
(assert (member (find-class 'a) (class-precedence-list (find-class
'c))))
Jimka wrote:
> Can someone tell me whether this following assertion
> should fail or not? The assertion fails in clisp 2.36 but
> succeeds in sbcl 0.9.4.
>
> (setf (fdefinition 'class-precedence-list)
> (fdefinition
> #+clisp 'clos::class-precedence-list
> #+sbcl 'sb-mop::class-precedence-list))
>
> (defclass a () ())
> (defclass b () ())
> (defclass c (b) ())
> (defclass b (a) ())
> (assert (member (find-class 'a) (class-precedence-list (find-class
> 'c))))
Both results are possible according to the CLOS MOP. The reason is that
the class precedence list is determined via
compute-class-precedence-list which is called, and its results stored,
by finalize-inheritance. However, finalize-inheritance is specified to
be called sometime between immediately after the class is defined and
immediately before the first instance of the class is created. You don't
create any instances in your example code, so in some implementations
the class precedence list may already be available, and in others it may
not.
You should check what happens after calling (finalize-inheritance
(find-class 'c)).
BTW, what do you mean with "the assertion fails"? In clisp 2.37,
(class-precedence-list (find-class 'c)) signals an error (which is
acceptable accourding to the CLOS MOP).
Pascal
--
My website: http://p-cos.net
Closer to MOP & ContextL:
http://common-lisp.net/project/closer/
On 6 Jan 2006 05:03:15 -0800, "Jimka" <·····@rdrop.com> wrote:
> Can someone tell me whether this following assertion should fail or
> not? The assertion fails in clisp 2.36 but succeeds in sbcl 0.9.4.
>
> (setf (fdefinition 'class-precedence-list)
> (fdefinition
> #+clisp 'clos::class-precedence-list
> #+sbcl 'sb-mop::class-precedence-list))
>
>
> (defclass a () ())
> (defclass b () ())
> (defclass c (b) ())
> (defclass b (a) ())
> (assert (member (find-class 'a) (class-precedence-list (find-class 'c))))
Are you sure the class C has been finalized at this point (in CLISP)?
Cheers,
Edi.
--
Lisp is not dead, it just smells funny.
Real email: (replace (subseq ·········@agharta.de" 5) "edi")