Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zephyr.ens.tek.com!uw-beaver!fluke!ssc-vax!dmg From: dmg@ssc-vax (David M Geary) Newsgroups: comp.object Subject: Re: Functions without side effects (was Old confusion) Keywords: functionality Message-ID: <4116@ssc-bee.ssc-vax.UUCP> Date: 14 Jun 91 17:14:46 GMT References: <130242@tut.cis.ohio-state.edu> <4888@osc.COM> <72893@microsoft.UUCP> Sender: news@ssc-vax.UUCP Reply-To: dmg@ssc-vax.UUCP (David M Geary) Organization: Boeing Aerospace & Electronics Lines: 75 In article <72893@microsoft.UUCP> jimad@microsoft.UUCP (Jim ADCOCK) writes: aIn article <4888@osc.COM> jgk@osc.COM (Joe Keane) writes: >>Some people would name either or both of these methods just `part', perhaps to >>save keystrokes. I think this indicates a confusion between a method and the >>value it returns. Here is the way i see it: `widget.part' is an attribute, >>`widget.get_part()' is a method call which returns the part, `widget.part()' >>is a mistake since you're trying to call an object, and `widget.get_part' is a >>method which would return the part if you called it. > >I disagree. > >Once upon a time there was a language called "Basic" that used a '=' >for both assignment and equality testing. Fearful that some beginners >might find this confusing, the language authors introduced the "let" >noise word: > > LET part = somepart; > >However users of the language recognized that this was silly and >redundant and chose not to use the noise word. > >Thus I claim: > >"Get" and "Set" are object oriented for "Let" > >---- > >Without redundant noise words this becomes simply: > > somepart = object.part(); > object.part(somepart2); > > In: LET part = somepart; The LET is obviously redundant due to the fact the the = implies it. Therefore, in: somepart = object.getpart(); The get is also redundant, because both the type of somepart, and the = imply that assignment is taking place. However, in: object.setpart(somepart2) That the set is redundant is only gleaned from the type of somepart2, and that does not (fully) imply that the object's part is being set. In the expression: object.part(somepart2), perhaps part is really a list of parts, and this operation adds somepart2 to the list of parts kept by the object. (Not the slickest design, admittedly, but not so totally irrational that nothing akin to it will/would ever be done). One might therefore advocate that an operator be defined such that we may write the expression: object() << somepart2; However, this is equally as vague to me. I agree with Jim on all other counts (which I ommitted in this article), for removing redundancy from method names, however, this set business does not seem so clear-cut. -- |~~~~~~~~~~ David Geary, Boeing Aerospace, Seattle, WA. ~~~~~~~~~~| |-----------------------------------------------------------------------------| |~~~~~~ Seattle: America's most attractive city... to the *jetstream* ~~~~~~| |-----------------------------------------------------------------------------|