🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jon L White Fri, 02 Oct 1992 16:26
Re: class variables
#307
Author: Jon L White
Date: Fri, 02 Oct 1992 16:26
37 lines
1997 bytes
Another approach to what are increasingly being called "per-class slots":


   --  set up a metaclass for such classes with this altered inheritance;
	for sake of discussion, call it PER-CLASS-SHARED-SLOTS-CLASS

   --  place a method on ENSURE-CLASS-USING-CLASS specialized to this
	metaclass (i.e. PER-CLASS-SHARED-SLOTS-CLASS) which snoops at
	the :direct-superclasses argument to collect the names of all
	the shared slots from all the supers which are of metaclass
	PER-CLASS-SHARED-SLOTS-CLASS.  Then alter the :direct-slots
	argument to add canonicalized slot specifications for such
	shared slots (see CANONICALIZE-DIRECT-SLOT, which is also
	from AMOP), and then just CALL-NEXT-METHOD.

The trick here is to utilize all the pre-existing machinery of an
implementation's support for shared slots, but to fake-out the 
interface between DEFCLASS and the actual class creation protocol
to make it look like every DEFCLASS form for the new metaclass actually
had a :ALLOCATION :CLASS specification for any inherited shared slot.

So here we are using the metaobject protocol to alter the inheritance
behaviour within an (extended) metaclass.


Refinement:  figure out how to put the method on MAKE-INSTANCE, or
on INITIALIZE-INSTANCE, instead of on ENSURE-CLASS-USING-CLASS.

More refinement: figure out how to collate all the actual direct slot
specifications from the set of all superclasses so as to resolve  _each 
and every potential slot specification_  item in the automatically
generated slot spec list.




-- JonL --
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads