Re: [S] Assignment arrow.

Bill Venables (wvenable@attunga.stats.adelaide.edu.au)
Thu, 21 May 1998 09:26:20 +0930


Rolf Turner writes:
> > Alan Zaslavsky writes:
> > Thank you, you have provided ammunition for my (totally
> > fruitless and by now lost) argument that the use of "<-"
> > for assignment is an atrocity. You got bitten in these
> > lines:
> >
> > > out2[13] <- as.numeric(out2[5] <- 66.667 & out2[8] > -66.667)
> > > out2[14] <- as.numeric(out2[9] <- 66.667 & out2[12] > -66.667)
>
> I beg to differ. The construction
>
> ``out2[5] <- 66.667''
>
> appears very naturally to mean --- cries out to be interpreted
> as --- ``the value 66.667 gets sent to/flows into out2[5]''.
>
> Writing `` <- 66.667'', when ``< -66.667'' is meant, is the
> atrocity.

What passion over such a bagatelle...

The simple rule I urge on people is "always put whitespace before
and after the assignment operator". It would never fail if they
did it, but they never do, of course. In general people never do
pay enough attention to making code readible with appropriate
whitespace and it comes home to bite them again and again.

(It's even surprising how much easier ASCII text is to read if it
has two spaces rather than one at the end of sentences, and a
line length no longer than 65-70 characters. Whole generations
of typists knew this in their finger bones but this still
relevant ancient knowledge is now all but forgotten. Sigh.)

Bill.
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news