Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!wugate!uunet!cimshop!davidm From: cimshop!davidm@uunet.UU.NET (David S. Masterson) Newsgroups: comp.object Subject: Re: Pre-computing objects Message-ID: Date: 30 Oct 89 19:04:19 GMT References: <4158@cbnewsc.ATT.COM> Sender: davidm@cimshop.UUCP Distribution: usa Organization: Consilium Inc., Mountain View, California. Lines: 45 In-reply-to: jwd@cbnewsc.ATT.COM's message of 27 Oct 89 21:05:36 GMT In article <4158@cbnewsc.ATT.COM> jwd@cbnewsc.ATT.COM (joseph.w.davison) writes: Well, ignoring the issue about methods being stored with the objects, which is hardly ignorable,... Hmmm, anyone have any information on the idea of storing methods with objects? Especially in a non-object-oriented storage area? The way I wish I could do it is with OOYACC -- Like Yacc, but designed to work in an OO system. [munch] The parent constructor tries to create instances of each child, in some order, until one succeeds, or it fails -- and does whatever constructors do when they fail. This idea at least limits the amount of information the parent needs about the child. Of course the problem with this is that the parent object should never know about its children as this violates the idea of encapsulation of ideas that object-orientation is supposed to promote. Two other methods have come to light that bear examination, but I'm not happy with them either: 1. Assume that the child knows about its parent initializer function. It would call that initializer function when it is done with the persistent data that it got. The drawback is that if the parent of the child changes, the child must know about it. Also, some mechanism must still be found by which the child can convert its persistent information into a form that the parent's initializer function will accept. 2. Translating data from one form into another can be done through explicit casting. Therefore, a structure that represents data as it resides in the persistent storage area could have a cast function on it that would convert it to its parent type of object. The drawback here is this is something that you would expect C++ to do for you automatically, but persistent data seems to be the exception to the idea. -- =================================================================== David Masterson Consilium, Inc. uunet!cimshop!davidm Mt. View, CA 94043 =================================================================== "Nobody here but us chickens..."