🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #294

Re: CHANGE-CLASS on specialized metaclass

#294
From: Steve Haflich
Date: Tue, 10 Nov 1992 13:01
58 lines
3020 bytes
   From: charest@Aig.Jpl.Nasa.Gov (Len Charest)

   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:

   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:

   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.
   Comments?

I agree it should work, and that it should not matter whether the
class has yet been finalized.  So I tried to reproduce the failure,
but it worked just fine for me:

   Allegro CL 4.1 [SPARC; R1] (4/13/92 21:39)
   ...
   (1): (defclass my-class
	    (standard-class)
	    ((arbitrary-slot :initform (gensym))))
   #<STANDARD-CLASS MY-CLASS @ #x8977de>
   (2): (change-class (find-class 'my-class) (find-class 'my-class))
   #<MY-CLASS MY-CLASS @ #x8977de>
   (3): (find-class 'my-class)
   #<MY-CLASS MY-CLASS @ #x8977de>
   (4): (slot-value (find-class 'my-class) 'arbitrary-slot)
   #:G42

   Allegro CL 4.1 [SPARC; R1] (4/13/92 21:39)
   ...
   (1): (defclass my-class
	    (standard-class)
	    ((arbitrary-slot :initform (gensym))))
   #<STANDARD-CLASS MY-CLASS @ #x8977de>
   (2): (defclass your-class () () (:metaclass my-class))
   #<MY-CLASS YOUR-CLASS @ #x899dfe>	; finalizes inheritance
   (3): (change-class (find-class 'my-class) (find-class 'my-class))
   #<MY-CLASS MY-CLASS @ #x8977de>
   (4): (slot-value (find-class 'my-class) 'arbitrary-slot)
   #:G43

These two examples were in fresh images with no patches loaded.  I
can't be sure why the example didn't work for you, but the appearance
of STANDARD-CLASS as a FORWARD-REFERENCED-CLASS suggests a package
problem -- that you were working in some package in which the symbol
COMMON-LISP:STANDARD-CLASS is not present by inheritance.

I'll contact you privately from bugs@franz.com to pursue this without
bothering the entire common-loops list.
Technical Details
Message-ID: <9211110501.AA05051@vapor.Franz.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!franz.com!smh
References: <1992Nov11.010239.15658@jpl-devvax.jpl.nasa.gov>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!franz.com!smh
From: smh@franz.com (Steve Haflich)
Subject: Re: CHANGE-CLASS on specialized metaclass
Message-ID: <9211110501.AA05051@vapor.Franz.COM>
Sender: daemon@cis.ohio-state.edu
Organization: The Ohio State University Department of Computer and Information Science
References: <1992Nov11.010239.15658@jpl-devvax.jpl.nasa.gov>
Date: Tue, 10 Nov 1992 13:01:55 GMT
Lines: 58