🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #268

Avoiding CLASS-PROTOTYPE (Attn: MOP gods)]

#268
From: Eric Peterson x7644
Date: Thu, 05 Nov 1992 15:00
41 lines
2491 bytes
Hi Len;
   Some parens or better wording would have made my intent clearer; I
have added in parens -  *(* *)* - to clear up the ambiguity:

Since class instance prototypes have nothing but unbound slots, perhaps
the MOP should specify that class instance prototypes be created with
allocate-instance instead of using make-instance (as Lucid has done).

   Len> Lucid 4.0.2 *does* use MAKE-INSTANCE to create the class prototype. 

> (trace make-instance allocate-instance)
   Len> (MAKE-INSTANCE ALLOCATE-INSTANCE)
> (defclass test () ())
   Len> 1 Enter MAKE-INSTANCE #<Standard-Class STANDARD-CLASS>
   Len> | 2 Enter ALLOCATE-INSTANCE #<Standard-Class STANDARD-CLASS>
   Len> | 2 Exit ALLOCATE-INSTANCE #<Standard-Class #<Unbound-Slot 61A>>
   Len> 1 Exit MAKE-INSTANCE #<Standard-Class  #X1CE6F9E>
   Len> #<Standard-Class TEST>
> (clos:class-prototype *)
   Len> 1 Enter MAKE-INSTANCE #<Standard-Class TEST>
   Len> | 2 Enter ALLOCATE-INSTANCE #<Standard-Class TEST>
   Len> | 2 Exit ALLOCATE-INSTANCE #<Test #X1D03256>
   Len> 1 Exit MAKE-INSTANCE #<Test #X1D03256>
   Len> #<Test #X1D03256>

   Len> This behavior prevents me from writing the 'obvious' method for keeping class
   Len> prototype off of the instance list:

   Len> (defmethod make-instance :around ((class caching-class) &rest args)
   Len>   (let ((instance (call-next-method)))
   Len>     (unless (eq instance (clos:class-prototype class))
   Len>       (push instance (class-direct-instances class)))
   Len>     instance))

   Len> Because CLASS-PROTOTYPE and MAKE-INSTANCE are now mutually dependent, attempting
   Len> to make any instance of a class whose metaclass is CACHING-CLASS will cause an
   Len> infinite recursion.
   Len> ..................................................
   Len>                                   Len Charest, Jr.
   Len>                  JPL Artificial Intelligence Group
   Len>                           charest@aig.jpl.nasa.gov
Technical Details
Message-ID: <9211051500.AA16324@verdi.iisd.sra.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sra.COM!peterson
References: <1992Nov4.183247.6578@jpl-devvax.jpl.nasa.gov>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sra.COM!peterson
From: peterson@sra.COM (Eric Peterson x7644)
Subject: Avoiding CLASS-PROTOTYPE (Attn: MOP gods)]
Message-ID: <9211051500.AA16324@verdi.iisd.sra.com>
Sender: daemon@cis.ohio-state.edu
Organization: The Ohio State University Department of Computer and Information Science
References: <1992Nov4.183247.6578@jpl-devvax.jpl.nasa.gov>
Date: Thu, 5 Nov 1992 15:00:32 GMT
Lines: 42