[clpython-devel] Re: CLPython on SBCL
Robert Brown
brown at google.com
Thu May 1 17:30:25 UTC 2008
The call to ensure-class without
:metaclass 'py-core-type
succeeds.
The call with the :metaclass argument fails inside change-class:
(defmethod change-class ((instance standard-object) (new-class standard-class)
&rest initargs)
(unless (class-finalized-p new-class)
(finalize-inheritance new-class))
(let ((cpl (class-precedence-list new-class)))
(dolist (class cpl)
(macrolet
((frob (class-name)
`(when (eq class (find-class ',class-name))
(error 'metaobject-initialization-violation
:format-control "~@<Cannot ~S objects into ~S
metaobjects.~@:>"
:format-arguments (list 'change-class ',class-name)
:references (list '(:amop :initialization ,class-name))))))
(frob class)
(frob generic-function)
(frob method)
(frob slot-definition))))
(change-class-internal instance new-class initargs))
CLASS is on the class precedence list of PY-CORE-TYPE.
bob
====================
Willem Broekema writes:
> Hello Bob,
>
> On Thu, May 1, 2008 at 5:52 PM, Robert Brown <brown at google.com> wrote:
>
> > I tried to get CLPython up and running on the latest SBCL. The diff below
> > contains a couple of easy fixes. SBCL wants BREAK's argument to be a
> > string
> > and SBCL's LOOP does not like a negative loop increment.
>
>
> Thanks for the patches!
>
>
> > The real porting problem right now is CLOS related. SBCL does not like
> > the
> > following code in core/classes.lisp:
> >
> > ;; Fix superclass and metaclass of PY-DICT.
> > (ensure-class 'py-dict
> > :direct-superclasses (list 'py-core-object)
> > :metaclass 'py-core-type)
> >
> > I get the following error:
> >
> > debugger invoked on a SB-PCL::METAOBJECT-INITIALIZATION-VIOLATION in
> > thread
> > #<THREAD "initial thread" {11701A79}>:
> > Cannot CHANGE-CLASS objects into CLASS metaobjects.
> > See also:
> > AMOP, Initialization of Class Metaobjects
> >
> > I think the problem is that PY-DICT is a normal class and the ENSURE-CLASS
> > call tries to turn it into a metaclass. Anyway, I'm far from a CLOS
> > expert.
>
>
> Well, class py-dict is not turned into a metaclass here, at least that's not
> the intention. :) The superclass and metaclass of it are changed but py-dict
> remains a non-metaclass class. So I think the actual error message is
> incorrect, but something else is wrong.
>
> The problem might be that you can not change the metaclasses of a class
> using ensure-class. Could you please check if the call to ensure-class
> without the metaclass change is accepted?
>
> (ensure-class 'py-dict
> :direct-superclasses (list 'py-core-object))
>
> Thanks,
> - Willem
More information about the Clpython-devel
mailing list