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

Chap 3 question: Class of allocated instances.

   Date: Tue, 11 Apr 89 23:31:52 PDT
   From: Jon L White <jonl>

   I'm wondering why one can't count on the following being true:

      (eq (find-class 'foo)  (class-of (allocate-instance 'foo)))
This is too restrictive, I think. Flavors defines some mechanisms where this
wouldn't be true. I know these machanisms are used in customer code.

   Presumably, if a programmer defined a method on 'allocate-instance'
   he could have it return any old sort of widget (rather than a "foo").  
   Is this useful?  Is it still useful if the constraint is added that

      (subtype (class-of (allocate-instance 'foo)) 'foo)
This looks more reasonnable. However I don't know if it gives  a tremendous
performance leverage for implementation to impose this restriction on all
metaclasses. I would like to see an argumentation before putting this
restriction (consistency of meta concepts, performance optimizations....,
flexibility of extension, less built-in assumptions....)