[Openmcl-devel] mop issue

rm at fabula.de rm at fabula.de
Sat Oct 2 11:40:54 PDT 2004


On Sat, Oct 02, 2004 at 10:41:14AM -0700, Cyrus Harmon wrote:
> 
> My guess is that you can't just drop a class onto the cpl as that isn't 
> enough to make OpenMCL know that it is now one of its direct 
> superclasses.

I object to that. I played a bit with Marco's sample code in
the repl: from what i can see the cpl-manipulation works for 
class 'foo' [do an (inspect (find-class 'foo)) - 'super is 
on the cpl for 'foo]. 

> I did something similar sticking the superclass onto the 
> :direct-superclasses in an around method in initialize-instance and 
> reinitialize-instance.

That sounds like a wise idea - at least if Marco wants to do 
what he seems to want to do (have 'super be a superclass for 
all kclass instances). 


> I used the clsql MOP stuff as a guiding example 
> and that seemed to work pretty well.

The way clsql deals with that (IIRC) is to use a special
macro that does that: def-view-class will both put the right
superclass in the direct-superclasses list and add the metaclass
option to the class defintion. I guess that' a good model.

 just my 0.02$

   Ralf Mattes
> 
> Cyrus
> 
> On Oct 2, 2004, at 6:41 AM, marco wrote:
> 
> >
> >i originally thought this was a miss understanding on my part, but
> >sbcl and cmucl both deal with this code without a hitch.
> >
> >(in-package :common-lisp-user)
> >
> >(defclass kclass (standard-class)
> >  ())
> >
> >(defmethod mopp:validate-superclass ((sub kclass) (super 
> >standard-class))
> >  t)
> >
> >(defclass super ()
> >  ()
> >  (:metaclass kclass))
> >
> >(defmethod mopp:compute-class-precedence-list ((class kclass))
> >  (let ((cpl (call-next-method))
> >        (super-cpl (mopp:class-precedence-list (find-class 'super))))
> >    (if (member (find-class 'super) cpl)
> >        cpl
> >        (append (remove-if (lambda (class) (member class super-cpl)) 
> >cpl)
> >                super-cpl))))
> >
> >(defclass foo ()
> >  ()
> >  (:metaclass kclass))
> >
> >(defclass bar (foo)
> >  ()
> >  (:metaclass kclass))
> >
> >when attempting to define the BAR class i get an "Inconsistent
> >superclasses for #<KCLASS BAR>" error. i think the issue in in
> >ccl::compute-cpl, but my understanding of the MOP (and in particular
> >openmcl's implementation) is way to weak to figure out what's wrong.
> >
> >-- 
> >-Marco
> >Ring the bells that still can ring.
> >Forget your perfect offering.
> >There is a crack in everything.
> >That's how the light gets in.
> >     -Leonard Cohen
> >_______________________________________________
> >Openmcl-devel mailing list
> >Openmcl-devel at clozure.com
> >http://clozure.com/mailman/listinfo/openmcl-devel
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list