Newsgroups: comp.lang.smalltalk Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!m.cs.uiuc.edu!cs.uiuc.edu!voss From: voss@cs.uiuc.edu (Bill Voss) Subject: Re: Access methods - New feature ? In-Reply-To: brian@vuse.vanderbilt.edu's message of 21 Apr 91 22:11:49 GMT Message-ID: Sender: news@m.cs.uiuc.edu (News Database (admin-Mike Schwager)) Nntp-Posting-Host: laslo.cs.uiuc.edu Organization: Typed Smalltalk Group, Dept of Comp Sci, Univ of IL in Urbana. References: <1991Apr21.221149.8057@vuse.vanderbilt.edu> Date: 22 Apr 91 11:36:38 Lines: 26 In article <1991Apr21.221149.8057@vuse.vanderbilt.edu> brian@vuse.vanderbilt.edu (Brian Antao) writes: > Often one needs to define access methods > with each Class definition, these methods simply return the current value of > an instance variable. The suggested feature would be, that the compiler/ > interpreter, by default inserts these methods corresponding to each instance > variable specified in the Class definition. Methods such as these are the Smalltalk equivalent of the GOTO statement. Yes I have written and used such methods. They are especially useful during the early exploratory/debugging stages. However, they violate the fundamental principles of encapsulation which make OOP so useful. I definitely do NOT want such a "feature" added as a standard part of the language. I am not saying don't use such methods. I am saying that until you finish eliminating such methods from a design, you should know you are not finished creating your design. Exception: Objects which exist solely to "encapsulate" external interfaces must frequently violate this rule, until you can redesign the external part of the interface. This is in large part a religious/style question, and I am obviously a "purist" on this one. Some heretic ;-) will probably post a goodie which does almost exactly what you want. It looks like a rather simple problem (at least in st80). Bill Voss