Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MOP/pcl anomaly in CMUCL?

0 views
Skip to first unread message

Christian Lynbech

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
In an attempt to backport some code from scheme (guile/goops) I tried
to make a simple test, taken from AMOP (the dynamic slots example).

I was trying to do the following:

(defclass dynamic-slots-class (standard-class) ())
(defclass test () ((a1)) (:metaclass dynamic-slots-class))

My expectation was that since I have not specialized any MOP
functions, the above should work as normal.

However I got the error:

Error in function PCL::|(FAST-METHOD SHARED-INITIALIZE :AFTER (STD-CLASS T))|:
The class #<Standard-Class STANDARD-OBJECT {281553C5}> was specified as a

super-class of the class #<Dynamic-Slots-Class TEST {480CD265}>;
but the meta-classes #<Standard-Class PCL::STANDARD-CLASS {2815500D}> and
#<Standard-Class DYNAMIC-SLOTS-CLASS {481028A5}> are incompatible.
Define a method for PCL:VALIDATE-SUPERCLASS to avoid this error.

Can anybody explain to me what is worng here and how to correct it? Is
there any documentation on the PCL MOP that I should read?

(I can also add that it works as I had originally expected in ACL5.)

Complete transcript of the session below.


* (defclass dynamic-slots-class (standard-class) ())
Compiling LAMBDA (#:G859 #:G861 #:G862):
Compiling Top-Level Form:
Compiling LAMBDA (#:G864 #:G876 #:G877):
Compiling Top-Level Form:

[GC threshold exceeded with 2,001,128 bytes in use. Commencing GC.]
[GC completed with 767,168 bytes retained and 1,233,960 bytes freed.]
[GC will next occur when at least 2,767,168 bytes are in use.]
Compiling LAMBDA (#:G889 #:G891 #:G892):
Compiling Top-Level Form:
Compiling LAMBDA (#:G894 #:G896 #:G897):
Compiling Top-Level Form:
Compiling LAMBDA (#:G899 #:G901 #:G902):
Compiling Top-Level Form:
#<STANDARD-CLASS DYNAMIC-SLOTS-CLASS {481F048D}>
* (defclass test () ((a1)) (:metaclass dynamic-slots-class))


Error in function PCL::|(FAST-METHOD SHARED-INITIALIZE :AFTER (STD-CLASS T))|:
The class #<Standard-Class STANDARD-OBJECT {281553C5}> was specified as a

super-class of the class #<Dynamic-Slots-Class TEST {480CD265}>;
but the meta-classes #<Standard-Class PCL::STANDARD-CLASS {2815500D}> and
#<Standard-Class DYNAMIC-SLOTS-CLASS {481028A5}> are incompatible.
Define a method for PCL:VALIDATE-SUPERCLASS to avoid this error.

Restarts:
0: [ABORT] Return to Top-Level.

Debug (type H for help)

(PCL::|(FAST-METHOD SHARED-INITIALIZE :AFTER (STD-CLASS T))|
(#(NIL 14 5 8) . #())
#<unavailable-arg>
#<Dynamic-Slots-Class TEST {480CD265}>
#<unavailable-arg>
...)
0]

---------------------------+--------------------------------------------------
Christian Lynbech | Ericsson Telebit A/S
Fax: +45 8628 8186 | Fabrikvej 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28 | email: c...@tbit.dk --- URL: http://www.tbit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
- pet...@hal.com (Michael A. Petonic)

Pierre R. Mai

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
Christian Lynbech <c...@tbit.dk> writes:

> In an attempt to backport some code from scheme (guile/goops) I tried
> to make a simple test, taken from AMOP (the dynamic slots example).

When using the MOP of CMUCL/PCL you have to take into account a number
of issues (in other implementations, you have to take into account
other sets of issues, which makes portable MOP programming less
enjoyable than it could be. I hope that current and future efforts of
the standardization committees will improve that situation ;):

* Make sure that you use the right symbols: A number of symbols (like
e.g. standard-class) exist in two variants, one in the COMMON-LISP
package, and one in the PCL package. For MOP programming you
usually need the ones in PCL.

* Take a look at the MOP package, which exports most (but not all) of
the symbols defined in AMOP.

* Since CMUCL uses special wrappers around class-objects, you
sometimes need to use pcl::coerce-to-pcl-class to coerce those
wrappers into the real PCL/MOP class objects (e.g. when using
class-of).

* It's neccessary to define methods on pcl:validate-superclass more
often than is mentioned in AMOP.

The last issue will probably lie at the heart of your problem: Since
test (whose metaclass is dynamic-slots-class) inherits from t (whose
metaclass is standard-class), you have to define this combination
valid:

(defmethod pcl:validate-superclass
((class dynamic-slots-class) (super pcl:standard-class))
t)

> I was trying to do the following:
>
> (defclass dynamic-slots-class (standard-class) ())
> (defclass test () ((a1)) (:metaclass dynamic-slots-class))

Regs, Pierre.

--
Pierre Mai <pm...@acm.org> PGP and GPG keys at your nearest Keyserver
"One smaller motivation which, in part, stems from altruism is Microsoft-
bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]

0 new messages