Xref: utzoo comp.lang.eiffel:1696 comp.object:3817 Newsgroups: comp.lang.eiffel,comp.object Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!seal.cis.ohio-state.edu!ogden From: ogden@seal.cis.ohio-state.edu (William F Ogden) Subject: Re: Reference Semantics Message-ID: <1991Jun26.204549.27784@cis.ohio-state.edu> Sender: news@cis.ohio-state.edu (NETnews ) Organization: The Ohio State University, Department of Computer and Information Science References: <1991Jun19.001829.28317@syacus.acus.oz.au> <1991Jun21.215959.13966@cis.ohio-state.edu> <1991Jun22.175434.21450@cunews.carleton.ca> Date: Wed, 26 Jun 1991 20:45:49 GMT Lines: 57 In article <1991Jun22.175434.21450@cunews.carleton.ca> knight@mrco.carleton.ca (Alan Knight) writes: >>>As object oriented programming reflects the real world, it seems that >>>references will be inevitable. >>At the risk of getting back into those dangerous analogies, note that >>referencs semantics really entail multiple larger objects routinely sharing >>possesion of smaller objects. For very good reasons, this rarely happens >>in the real world. Imagine, for example, several people in a room each >>possesing a remote tuner for the room's only television set. The chaos ... > The phrase "larger objects ... sharing possession of smaller >objects" implies a physical part-of relationship, sharing of which >doesn't often happen in the real world. That doesn't mean that >objects aren't shared. The issue here certainly wasn't that objects aren't and shouldn't be shared -- both in the programming and in the real world. The concern was that multireferences to objects entails the simultaneous _shared possession_ of those objects by other entities in the system. > In fact, in the "real" world that I live in, objects are usually >shared, and copying is fairly rare. At my house, we have one >television set which is shared between all the residents. It's true >that there's only one remote control, but if my wife decides to change >the state of the television set, it certainly affects the copy that >I'm referencing. In your world then there is only one television object whose use is shared by several other entities. The entities are aware of each other and that in order to function properly, they must set up and obey certain conventions regarding the use of the television. [Supposing that a remote controller is an adequate analogue of a reference to a TV object,] you then follow the simplifying convention of only having ONE reference to your TV and of sharing (at different times) the use of that reference. If you had several TV's and remote tuners which could selectively control any TV, then the physical situation here might begin to approach the complexity inherent in reference semantics. > Copying semantics (in which as soon as I walk into the room I get my >own television to look at) would be rather disconcerting. >Copy-on-write would be rather entertaining, if anyone who changed the >channel got a new television set. ... As I said early in this discussion, copying of large objects is difficult and expensive, and it should be avoided if at all possible. > To actually make a point: The real world has state and reference >semantics all over the place. There may be good arguments for >avoiding them, but the claim that they are not used in the real world >is not one of them. Objects in the real world certainly have state. Actual examples of reference semantics, however, seem to be hard to come up with. Objects are visible and accessible to multiple entities in a physical environment, just as variables are in a programming environment, but that's clearly not analogous to having multiple references.