Xref: utzoo comp.lang.eiffel:1639 comp.object:3676 Newsgroups: comp.lang.eiffel,comp.object Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!m.cs.uiuc.edu!cs.uiuc.EDU!johnson From: johnson@cs.uiuc.EDU (Ralph Johnson) Subject: Re: Reference Semantics Message-ID: <1991Jun10.215822.28034@m.cs.uiuc.edu> Sender: news@m.cs.uiuc.edu (News Database (admin-Mike Schwager)) Nntp-Posting-Host: m.cs.uiuc.edu Reply-To: johnson@cs.uiuc.EDU (Ralph Johnson) Organization: University of Illinois References: <1177@tetrauk.UUCP> <131263@tut.cis.ohio-state.edu> <1178@tetrauk.UUCP> <131691@tut.cis.ohio-state.edu> <1181@tetrauk.UUCP> Date: Mon, 10 Jun 1991 21:58:22 GMT As a longtime Smalltalk programmer, I don't see how its use of reference semantics causes problems. Reference semantics and copy semantics are not just different styles of programming, they are different *semantics*. They mean different things. Sometimes a programmer wants to have stateless values, and sometimes a programmer wants to have objects with state. A language should support both. I've tried functional programming in C, and it is hard, mostly because of the lack of garbage collection. Programming with immutable objects and without side effects is not hard in Smalltalk. I usually partition a system into the "stateless" parts and the "stateful" parts. I usually consider it an improvement when I can convert mutable objects to immutable objects. That doesn't happen often, because it is usually pretty obvious which is which. I can understand how someone who dosen't understand reference semantics (or copy semantics, for that matter) will have problems when they first start to use it. People have trouble with nearly anything when they first start to use it, including procedures, side effects, recursion, inheritance: in short, programming! Improper use of references can certainly cause problems, but improper use of anything can cause problems. I shudder when I see someone passing a "store" in a functional language to simulate reference semantics. Reference semantics makes many programs simpler.