[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

instance/class dependency



Should the existance of an instance depend on the existance of its class?
I can see reasons for and against this kind behaviour, vis a vis
histories, permanent storage, program development, etc.  What is the
prescribed behaviour of CLOS, and Statice in this situation?
In flavors I found that...

(defflavor gestaldt ()())

(defmethod (yo! gestaldt)()
  (print "gottcha!"))

(setq gestaldt-instance (make-instance 'gestaldt))

#<GESTALDT 60136513>

Kill the definition of gestaldt

Find out the type of gestaldt-instance

(type-of gestaldt-instance)

GESTALDT

(describe gestaldt-instance)
#<GESTALDT 334057201>, an object of flavor GESTALDT,
 has no instance variables.

(typep gestaldt-instance 'instance)
T

...BUT

(typep gestaldt-instance 'gestaldt)

1Error: GESTALDT is not a known type.

0(yo! gestaldt-instance)
1Error: The generic function YO! was applied to the argument #<GESTALDT 334057201>.
0       1The argument was not of the correct type.
0       1The function is implemented by no flavors.



0Arthur A. Keen
Knowledge Based Systems Lab.
Texas A&M University
College Station
Texas 77843-3317
USA

Email Arthur@Guinevere.tamu.edu