On Tuesday 13 January 2004 00:42, Martin Rydstr|m wrote:
> [EMAIL PROTECTED] writes:
> > * (defclass toto () ())
> > #<STANDARD-CLASS TOTO {480A46FD}>
> >
> > ; now i want to create a subclass of toto :
> >
> > * (pcl:ensure-class nil :direct-superclasses (list (find-class 'toto)))
> > #<STANDARD-CLASS TOTO {480A46FD}> is not a class or a legal class name.
>
> You probably want to use a different name for the class; nil is
> already defined, and all sort of chaos would probably ensue on
> redefinition. In 18e, also, you want to use class /names/, not
> class /objects/.
>
> That is, (list 'toto) instead of (list (find-class 'toto)).
>
> It seems to work using class objects in Gerd's PCL, as in the
> december snapshot of CMUCL.

pb 1 : "not a class"

from "ensure-class-using-class" specification :
  ":direct-superclasses ..."  "If the element is a class metaobject, that 
class metaobject is used."

in fact it works if i write "pcl:find-class" instead of "find-class" which 
refers to "lisp:find-class"


pb 2 : "nil as name"

"a new class metaobject is created by calling the make-instance"
"The proper name of the newly created class metaobject is set to name"

and make-instance say that it is called with "(find-class name)" so 
"(find-class nil)". It is not a default behavior for an anonymous class. I 
was wrong there.

I have to generate class names or use a default class name and then use (setf 
(class-name ...) nil) as said by Rahul.

MOP ref : http://www.lisp.org/mop/index.html


ctu.


Reply via email to