Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news3.near.net!noc.near.net!paperboy.wellfleet.com!news-feed-1.peachnet.edu!gatech!howland.reston.ans.net!ix.netcom.com!netcom.com!hasty
From: hasty@netcom.com (Amancio Hasty Jr)
Subject: Re: Dynamic inheritance using Scheme?
Message-ID: <hastyD3n6zG.2yo@netcom.com>
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
References: <thinmanD38L3s.LrF@netcom.com> <3grbth$542@agate.berkeley.edu> <3h2a8o$p08@gap.cco.caltech.edu>
Date: Tue, 7 Feb 1995 18:21:16 GMT
Lines: 70

Well, I sent mail to the stk group and this is what Erik said:
(I hope that he doesn't mind me quoting him since I think 
others using stk will benefit from his explanation)

From: Erick Gallesio <eg@kaolin.unice.fr>

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

-------

Works like a charm :)

	Thanks to all who responded!
	Amancio



-- 
FREE unix, gcc, tcp/ip, X, open-look, netaudio,  tcl/tk, MIME, 
midi,sound at  freebsd.cdrom.com:/pub/FreeBSD
	Amancio Hasty,  Consultant 
	Home: (415) 495-3046       
	e-mail hasty@netcom.com	   
