Assignment operators (was [R] modifying a vector)

Mark.Bravington@csiro.au Mark.Bravington@csiro.au
Mon, 1 Jul 2002 19:13:38 +1000


Bill Venables expected howls of protest about deprecation of underscore for
assign. Here's my one-and-only howl on this point:

(1) I don't like <- as an assignment operator, because it creates an
ambiguity with comparisons: I can write "x+1", "x-1", "x<1" but not "x<-1".
However, I guess it's a bit much to expect the entire R/S community to do
away with "<-" in favour of "_" or Delphi (Pascal) notation ":=", much as it
would delight me; so we're stuck with <- I guess.

(2) "_" strikes me as completely unambiguous. It means assignment, and
that's all it means. For my money, that's more important than aesthetics.
Anyway, if you choose a nice colourscheme, the _ doesn't look that bad. Me,
I like green.

(3) for my remaining bit of money, "=" should not be allowed at all as an
assignment operator: S made a mistake but R doesn't have to.
"="-as-assignment has to be hedged with all sorts of conditions to prevent
ambiguities, and to have an operator which frequently can't be used doesn't
seem helpful. Having it "grudgingly available to the cognoscenti" is not all
that much better!

(4) If deprecation is the first step on the road to removal and to "_" being
allowed in unquoted variable names, then that would be tiresome. I have many
hundreds of functions spanning thousands of lines of S/R code, filled with
"_"s. I really don't want to spend time changing all of them just to solve a
non-problem in R. Which is, I should emphasize, a wonderful piece of
software.

Summary: to lose "_" and gain "=" would be a double whammy with added salt
in the wound.

cheers
Mark

Mark Bravington
CSIRO (CMIS)
PO Box 1538
Castray Esplanade
Hobart
TAS 7001

phone (61) 3 6232 5118
fax (61) 3 6232 5012
Mark.Bravington@csiro.au 
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._