Xref: utzoo comp.lang.eiffel:1699 comp.object:3822 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.eiffel,comp.object Subject: Re: Reference Semantics Message-ID: <1991Jun27.070321.23955@Think.COM> Date: 27 Jun 91 07:03:21 GMT References: <1991Jun21.215959.13966@cis.ohio-state.edu> <1991Jun22.175434.21450@cunews.carleton.ca> <1991Jun26.204549.27784@cis.ohio-state.edu> Sender: news@Think.COM Reply-To: barmar@think.com Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 27 In article <1991Jun26.204549.27784@cis.ohio-state.edu> ogden@seal.cis.ohio-state.edu (William F Ogden) writes: >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. Why isn't it? To continue the TV analogy, consider a class TV-WATCHER (representing people who watch TV), with a slot TV-BEING-WATCHED, and a class TELEVISION-SET. If several TV-WATCHERs are in the same room, they would all be watching the same TV, so they would have references to the same TELEVISION-SET in their TV-BEING-WATCHED slots. Sharing this reference is necessary to deal with state changes in the TELEVISION-SET. For instance, if one TV-WATCHER changes the channel, all the TV-WATCHERs are now watching a different channel. If each TV-WATCHER had a copy of the TELEVISION-SET object, propagating these state changes would be harder (you'd have to maintain a list of all the equivalent TELEVISION-SETs). -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar