jamin@priam.usc.edu (Sugih Jamin) (02/28/90)
I just returned from the IEEE's CompCon '90 in SF. In the tutorial I attended, David Black from CMU gave a superb introduction to programming on Mach He also mentioned "inheritance delegation" as one of the possible future Mach's feature. At the tutorial I thought I understood what he meant by "inheritance delegation," but now thinking over it I don't think I quite understand him. Could somebody (from CMU) please give me more information on this topic? Thanks. sugih
af@spice.cs.cmu.edu (Alessandro Forin) (03/02/90)
In article <23131@usc.edu>, jamin@priam.usc.edu (Sugih Jamin) writes: > At the tutorial I thought I understood > what he meant by "inheritance delegation," > > sugih There are two U*x emulators that can run on top of the Mach3.0 kernel, here we are talking about the "multi-server" one. Which is based on the MachObjects package, which is a set of C macros that let you write OO code without having a (still) not-widely available OO language. [And even so we would also need dynamic loadable classes and remote method invocation]. Let's use an example. Program A wants to access data which a file server S provides. The program does not know what sub-class of the class (say) FILE will properly describe the data, perhaps a new esoteric one, as server S is pretty new. What the program can do is to create a generic object of the FILE class, contact the server (authenticate etc..) and receive back a new object of the proper class. [Which, if unheard of so far, will be dynamically loaded]. We will call this new object the DELEGATE object: MyFileObject --> DelegateObject (FILE) (MAPPED_FILE) The new object also needs to remember where it came from, because some methods might have to be executed in the context of server S. MyFileObject --> ItsDelegateObject ==> ItsRemoteObject (FILE) (MAPPED_FILE) (SECURED_MAPPED_FILE) Here is how method lookup works in this most general case. a) The single-inheritance chain of MyFileObject will be followed first, looking for a matching method. b) Since there is a delegate object, step (a) is repeated for ItsDelegateObject, e.g. we lookup along the single-inheritance chain of ItsDelegateObject. c) This also fails. But since ItsDelegateObject has a remote object we now try invoking the method remotely with an RPC to S. Server S (one of the threads in it) will now start all over this process on ItsRemoteObject. The correct way to describe this process is "Multiple Inheritance via Delegation". If you are familiar with OO systems you will find interesting to apply this example to your favorite OO language and think of ways to solve it without using delegation. You will find yourself in trouble. [You MUST assume both (a) multiple object bases and (b) multiple disjoint address spaces]. sandro-