Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ames!sgi!shinobu!odin!keyboard.esd.sgi.com!robins From: robins@keyboard.esd.sgi.com (Robin Schaufler) Newsgroups: comp.lang.c++,sgi.engr.c++ Subject: Re: Message dispatching Message-ID: <7484@odin.corp.sgi.com> Date: 9 May 90 20:27:35 GMT Sender: news@odin.corp.sgi.com Reply-To: robins@keyboard.esd.sgi.com (Robin Schaufler) Organization: Silicon Graphics Inc. Lines: 52 Mike Roberts proposes a language extension for C++ late binding. I have a similar need for late binding, although I have very different problems to solve. First a description of the problems I'd like to have late binding for, then a different idea for a language extension. The first problem is that if the code for the methods for an object is local to my process, I'd like to just do a function call to a member function, but if it's in another process, I'd like its member functions to perform rpc to the other process. The second problem is that if I have an object in shared memory, I'd like to invoke a virtual member function, and have it look up the address of the function based on both the member function index and the pid. Current ugly solution is to require the code to be in a shared library, and therefore at the same address in both processes, but that's excess mechanism, and shared libraries at SGI don't support breakpoints. About Mike Roberts' problem... I don't think database clients want to know about version objects. It seems more "natural" to call member functions of the text object, and want the version function to be automatically interposed on it. So I'd rather see a runtime interface to virtual function tables. For instance, suppose the text class in Mike's example declares the version class a friend. A version object might save the old member functions as data, and replace them with new member functions that do their thing and then call the old member functions. There would have to be a way to map from the text object to the version object, but that could be done either by sticking a pointer in the base class or with a static table. This doesn't quite solve the problem with the object in shared memory because it doesn't change the algorithm for vtable lookup. But given that Dewhurst and Stark publishes a _new_handler to override error handling behavior of new, it seems to me that there could be an analogous mechanism for overriding vtable lookup. It could even be done as a member function, so long as it isn't virtual. Our issues are as burning for us as this version control issue is for Mike Roberts, so I'd appreciate answers to his questions, too. To reiterate his questions, they are: - Does C++ already provide other mechanisms to do what I (we) need? - Has someone else already suggested this? - Does anybody out there like the basic intent of what I am suggesting? - Is there a better way, or a more general way to express this? To those of you who got this far, THANK YOU for your kind attention! And thank you, Mike, for breaking the ice. Robin Schaufler Standard: the personal flag of the ruler of a state; loosely, a banner. - Webster's New Practical Dictionary