Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!ucsd!ucsdhub!hp-sdd!apollo!apollo.hp.com!yon From: yon@apollo.HP.COM (David Yon) Newsgroups: comp.lang.smalltalk Subject: Data Hiding... Message-ID: <4820c7e4.20b6d@apollo.HP.COM> Date: 19 Jan 90 13:23:00 GMT Sender: root@apollo.HP.COM Reply-To: yon@apollo.HP.COM (David Yon) Followup-To: comp.lang.smalltalk Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 22 Thanks for all the responses to my posting on Data Hiding in Smalltalk. First off, to those who questioned this...YES, I know *why* the data-hiding breaks down, that was never in question. However, what I wanted to bring to light is that there is an awful lot of Smalltalk code (at least when browsing the STV/286 system) that just answers one of it's instance variables, instead of making a copy. Although this is standard practice, it would seem easy to be lulled into a false sense of security, since after all: "only an object can modify it's own internal state". If "get" and "put" methods merely answer references rather than new instances, this is decidedly not that case. There are of course many contexts in which answering with a reference is the right thing to do. There are also many times where it's unclear whether you should answer by reference or with a new instance. Thanks again for the response. David Yon