Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!decwrl!pa.dec.com!jrdzzz.jrd.dec.com!tkou02.enet.dec.com!jit533!diamond From: diamond@jit533.swstokyo.dec.com (Norman Diamond) Newsgroups: comp.lang.eiffel Subject: Re: Reference Semantics Message-ID: <1991Jun13.074318.337@tkou02.enet.dec.com> Date: 13 Jun 91 07:43:18 GMT References: <131691@tut.cis.ohio-state.edu> <1181@tetrauk.UUCP> <133154@tut.cis.ohio-state.edu> <1991Jun12.072557.7282@jyu.fi> Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) Organization: Digital Equipment Corporation Japan , Tokyo Lines: 35 In article <1991Jun12.072557.7282@jyu.fi> sakkinen@jyu.fi (Markku Sakkinen) writes: >In article <133154@tut.cis.ohio-state.edu> ogden@seal.cis.ohio-state.edu (William F Ogden) writes: >>In article <1181@tetrauk.UUCP> rick@tetrauk.UUCP (Rick Jones) writes: >>>Pointers in C do cause problems, and we have the experience of that, >>> but it is >>>very easy to make a lot of mistakes in C with pointers because the language >>>doesn't help you handle them properly. References in an OOPL are a whole >>>different issue. >> >>Somehow I'm getting this deja vu sensation that we're back in the late 60's >>discussing Go To's. One side is saying that Go To's (object references) have >>an excessively complex semantics which can easily lead to programming errors. > >I think that the need to share some objects is much more fundamental >for object modelling than is the need to jump for imperative programming. >The (visible) use of references should be restricted to a minimum, >but accepted without remorse whenever it is necessary. I agree with that conclusion, but think that the reasoning and application are backwards. Sharing and aliasing are sometimes necessary and should be kept to a minimum, yes. I think the sharing and aliasing should be visible, so that readers will know what to expect. The invisible aliasing generated by reference semantics is worse than a label that is a target of multiple gotos. An object gets changed when the user didn't expect it, and has to do a lot of tracing to find out where.... Part of the problem with C pointers is that they are overused and abused as a result of C's treatment of arrays. (A garbage collection in C can be declared with [].) A fairer comparison would be Pascal-style pointers (or even PL/I-style pointers) vs. the invisible sharing generated by reference semantics. -- Norman Diamond diamond@tkov50.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it. Permission is granted to feel this signature, but not to look at it.