Re: Dynamic inheritance?

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Mon, 06 Feb 1995 11:22:22 +0000

I don't know what is dynamic inheritance and I'm surely wrong here. However,
I will try to give an example were the inheritance of a class is changed
manually.

The inheritance scheme is encoded in the class precedence list. Changing it
(it is contained in the cpl field of the class) permits to change the object
behaviour.

For instance,

 STk> (define foo (make <class> :name 'foo))
 #[undefined]
 STk> (slot-set! foo 'cpl (list foo <number> <object> <top>))
 #[undefined]
 STk> (describe foo)
 foo is a class. It's an instance of <class>
 Superclasses are:
 Directs slots are:
 Class Precedence List is:
     foo
     <number>
     <object>
     <top>

 Field Initializers
     ()

 Getters and Setters
     ()
 #f
 STk> (define x (make foo))
 #[undefined]
 STk> (define-method M ((x <number>)) 'number)
 m
 STk> (M x)
 number

Note: Fucntions change-class and deep-clone and shallow-clone should be useful
for your job. Since change-class is a method you can specialize it to your
needs.

I apologize but there is (not yet) documentation for this stuff. In the
meantime, you can have a look to the file STklos/stklos.stk. All the things
concerning inheritance are written in Scheme.

Hope it helps


                -- Erick


                -- Erick
Received on Mon Feb 06 1995 - 11:22:23 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST