Reasons for Lint rules

Frank Shearar Frank.Shearar at rnid.org.uk
Mon Feb 28 11:18:45 UTC 2005


Dan Ingalls <Dan at SqueakLand.org> wrote:
> 
> "Frank Shearar" <Frank.Shearar at rnid.org.uk> wrote...
> >It occurs to me that it'd be nice to see a rationale for the 
> Lint rules. Like, say, in a balloon text when you hovered 
> over the title of the rule in the SmallLint Results window.
> >
> >For instance, "Uses the result of an add: message" - why is 
> it bad form to do so? I mean, OrderedCollection>>add: does in 
> fact return the object you added.
> 
> Yes, but it *shouldn't*.  The only reason it does in Squeak 
> is that this piece of poor style wasn't recognized until 
> after the ST-80 release, it then got canonized by the ANSI 
> standard and now, perfect or not, the standard is somewhat 
> valuable to our participation in the larger Smalltalk community.
> 
> The reason it shouldn't do this is simply stylistic.  Methods 
> tend to be either procedures (that cause some activity or 
> state-altering effect) or functions (that return some useful 
> new value).  Functional methods obviously requires the return 
> of a significant result.  Procedural methods, so the style 
> goes, simply return self.

Ah, OK, this sounds good. My reasoning (taking the assumption that Lint rules have good reasons behind them) went something like this: a message with a name like #add: tells you that it adds something to something else, but it DOES NOT tell you that it happens to return the added object. Which, well, seems pretty close to the actual reasoning behind the rules.

<snip>
> 	- Dan
> 
> PS:  You can probably tell, I've got something more important 
> that I *should* be doing  ;-)

*g* I have a theory that lots of interesting Squeak stuff happens when we should be doing something more important.

frank


*******************************************************************
This email and attachments (if any) must be swept for viruses before opening. Their contents may be confidential or privileged and are intended solely for the named recipient. If you are not the intended recipient and you have received this email in error you must not read or use this email and should notify RNID on: +44 (0) 20 7296 8282.

 

RNID, Registered Office 19-23 Featherstone Street, London EC1Y 8SL No. 454169 (England, Registered Charity No. 207720)

********************************************************************




More information about the Squeak-dev mailing list