Article View: comp.lang.clos
Article #292CHANGE-CLASS on specialized metaclass
From: Len Charest
Date: Wed, 11 Nov 1992 01:02
Date: Wed, 11 Nov 1992 01:02
45 lines
2914 bytes
2914 bytes
Now that the discussion on class-prototype has died down, I thought I'd throw
this on the fire:
STANDARD-CLASS has the interesting property that it is an instance of itself.
Suppose I want to make a specilized metaclass that also has this property:
(defclass my-class (standard-class)
((arbitrary-slot :initform (gensym))) ;to keep things interesting
)
;;; now make my-class be an instance of itself
(change-class (find-class 'my-class) (find-class 'my-class))
;;; test the result (if any...)
(slot-value (find-class 'my-class) 'arbitrary-slot)
Should this work in a correct implementation of CLOS? Should it matter whether
MY-CLASS has been finalized before the call to CHANGE-CLASS? My intuition is that
the above code should perform as expected--even in the absence of a MOP since the
functions involved (DEFCLASS, CHANGE-CLASS and SLOT-VALUE) are all part of the
'regular' CLOS programmer interface. My experience shows otherwise:
Lisp Platform Result
---- -------- ------
Lucid 4.0.2 Sparc2/SunOS 4.1.1 Throws into debugger during CHANGE-CLASS.
"Expanding stack due to overflow..."
FINALIZE-INHERITANCE not implemented.
PCL July 92 Sparc2/SunOS 4.1.1 Works as expected regardless of whether
on Lucid MY-CLASS is finalized.
Allegro 4.1 Sparc2/SunOS 4.1.1 Throws into debugger during CHANGE-CLASS.
"No methods applicable for gf: CLOS:CLASS-DIRECT-
SLOTS with args (#<CLOS:FORWARD-REFERENCED-CLASS
STANDARD-CLASS...> of classes (CLOS:FORWARD-
REFERENCED-CLASS)"
Same error occurs if attempt to finalize MY-CLASS
before CHANGE-CLASS.
MCL 2.0 Quadra 700/Sys 7 Throws into debugger during CHANGE-CLASS, but
will work if MY-CLASS has no local slots.
FINALIZE-INHERITANCE not implemented.
Comments?
..................................................
Len Charest, Jr.
JPL Artificial Intelligence Group
charest@aig.jpl.nasa.gov
Technical Details
Message-ID:
<1992Nov11.010239.15658@jpl-devvax.jpl.nasa.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!netsys!decwrl!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!charestShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!netsys!decwrl!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!charest From: charest@Aig.Jpl.Nasa.Gov (Len Charest) Subject: CHANGE-CLASS on specialized metaclass Message-ID: <1992Nov11.010239.15658@jpl-devvax.jpl.nasa.gov> Keywords: metaclass finalization Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post) Nntp-Posting-Host: ai-cyclops Reply-To: charest@aig.jpl.nasa.gov Organization: NASA/Jet Propulsion Laboratory Date: Wed, 11 Nov 1992 01:02:39 GMT Lines: 45