Xref: utzoo comp.lang.eiffel:1686 comp.object:3776 Newsgroups: comp.lang.eiffel,comp.object Path: utzoo!utgpu!cunews!knight From: knight@mrco.carleton.ca (Alan Knight) Subject: Re: Reference Semantics Message-ID: <1991Jun22.175434.21450@cunews.carleton.ca> Sender: news@cunews.carleton.ca Organization: Carleton University, Ottawa, Canada References: <133644@tut.cis.ohio-state.edu> <1991Jun19.001829.28317@syacus.acus.oz.au> <1991Jun21.215959.13966@cis.ohio-state.edu> Date: Sat, 22 Jun 1991 17:54:34 GMT In article <1991Jun21.215959.13966@cis.ohio-state.edu> ogden@seal.cis.ohio-state.edu (William F Ogden) writes: >In article <1991Jun19.001829.28317@syacus.acus.oz.au> ian@syacus.acus.oz.au (Ian Joyner) 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 >that would normally result makes it clear why we avoid such situations in >the real world, and by analogy why we would be prudent to do so in our >programming world. 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. 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. 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. I'd soon be able to open my own electronics store. I'm not sure what would happen to the reference to the TV from the bookcase it sits on, though. We might need to clone quite a bit of stuff. 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. -- -- Alan Knight knight@mrco.carleton.ca +1 613 788 5783 Support Dept. of Mechanical and Aeronautical Engineering the Carleton University, Ottawa, Ontario, Canada, K1S 5B6 LPF