From: Thomas_E_Morgan@cup.portal.com
Newsgroups: comp.lang.clos
Subject: Example of boundary case (sort of long)
Date: Tue,  8 Sep 92 16:36:20 PDT
Organization: The Portal System (TM)
Distribution: world

Gregor,


>I'd like to try and help, but I don't understand just what it is you are
>trying to do.  For one thing, I can't understand what you mean by "slot
>storage for metaclass instances."  If you can say some more about this
>that would be good.  

Sorry for the odd phrasing; I was trying to emphasize that I was trying
manage the storage for the slots of the class that were storing things 
like: 
  -what are the instance slots
  -what are the direct superclasses
  -whatever else a class, regarded as an instance of something,
   has for slots.

My management of the storage impliments layered versions; see the example below
.

>One specific question is whether you are trying to change just the
>base-level semantics, or do you want a "three-level tower," where the
>base level isn't normal CLOS, and the first meta-level isn't normal
>CLOS, but the second meta-level is.

I was trying to really change the base level semantics, rather than 
floating my idea of meta-data on top of CLOS's.  I wanted to try this 
two level approach, since there is so much already in CLOS that helps
with meta-data management - things like the ability to change classes with
instances in existance, and effect change of class for a given instance.

>Perhaps an example?

Here's an edited dribble of what I was trying in May '90; the things to notice
are that my employee's names and so forth are being versioned, but so is 
the fact that employees have sexes, names etc,  at all.  For reasons that
Trent has pointed out, this doesn't even get off the ground in July 92 PCL,
and as I asked earlier, I'm not even sure that it should. 

   ...Tom M  

==============Warning, moderately long example follows======================

;-----------------------------------------------------------
;Some really boring code here, that uses slot-xxx-using
;to manipulate class and instance slots in a layered
;set of versions.
;-----------------------------------------------------------

(setq *current-version* *base-version*))        ; The base of versioned data
#<PCL::VERSION 3800808>

? (defclass versioned-person (versioned-object))        ; Make a person with
  ((sex :accessor sex :initarg :sex)                    ; versioned values for 
sex 
   (name :accessor name :initarg :name))                ; name and age
   (age :accessor age :initarg :age))
   )
  (:metaclass standard-versioned-class)))               ;and with versioned met
a data
#<Standard-Versioned-Class PCL::VERSIONED-PERSON 3825444>

? (setq *a* (make-instance 'versioned-person)))         ; Make a person to work
                                                        ; work


(setf (slot-value *a* 'name)) "Fred Flintstone")        ; Set the value of name
"Fred Flintstone"

? (slot-value *a* 'name))
"Fred Flintstone"

;-----------------------------------------------------------
;Now bump the version up, redefine with
;one less slot and change value of name slot.
;-----------------------------------------------------------

? (setq *current-version* *next-version*))
#<PCL::VERSION 3800892>

? (defclass versioned-person (versioned-object))        ; As before, but one sl
ot
  ((name :accessor name :initarg :name))                ; gone
   (age :accessor age :initarg :age))
   )
  (:metaclass standard-versioned-class)))
#<Standard-Versioned-Class PCL::VERSIONED-PERSON 3825444>

? (setf (slot-value *a* 'name)) "Barney Rubble")        ; Make a value change
"Barney Rubble"                                         ; in this new version

? (slot-value *a* 'name))
"Barney Rubble"

;-----------------------------------------------------------
;Do a describe in this version, look at the person in *a*
;-----------------------------------------------------------

? (describe *a*))
#<VERSIONED-PERSON 4075532> is an instance of class #<Standard-Versioned-Class 
VERSIONED-PERSON 3825444>:
 The following slots have :INSTANCE allocation:
 VERSIONED-SLOTS    (#<VERSION 3800892> (NAME "Barney Rubble") #<VERSION 380080
8> (NAME "Fred Flintstone"))
 The following slots have allocation as shown:
 AGE :VERSIONED            "unbound"
 NAME :VERSIONED           "Barney Rubble"

;-----------------------------------------------------------
;Now put the version back to the base, and see no harm done
;to either the slots or the values of the slots for
;versioned-person's 
;-----------------------------------------------------------
? (setq *current-version* *base-version*))
#<PCL::VERSION 3800808>

? (describe *a*))
#<VERSIONED-PERSON 4075532> is an instance of class #<Standard-Versioned-Class 
VERSIONED-PERSON 3825444>:
 The following slots have :INSTANCE allocation:
 VERSIONED-SLOTS    (#<VERSION 3800892> (NAME "Barney Rubble") #<VERSION 380080
8> (NAME "Fred Flintstone"))
 The following slots have allocation as shown:
 SEX :VERSIONED            "unbound"
 AGE :VERSIONED            "unbound"
 NAME :VERSIONED           "Fred Flintstone"

==============End of example=================================================











Gregor
Xref: sparky comp.lang.clos:784 comp.object:3445