behavior of =
Luke Tierney
luke@stat.uiowa.edu
Fri, 8 Nov 2002 12:15:58 -0600 (CST)
On Fri, 8 Nov 2002, Tony Plate wrote:
> At 08:41 AM 11/8/2002 -0800, A.J. Rossini wrote:
> >[...]
> >The "<-" assignment operator is beautiful. It's taken me over a
> >decade, but I have come to appreciate it. It isn't common, and there
> >are fewer and fewer ex-APL'ers, but I think it's a great choice.
> >
> >The use of "=" for named arguments in a function call signature makes
> >sense, and the use of "==" for equality makes sense.
> >
> >But syntactical sugar should only be messed with if broken (and yes,
> >this may be one of the few points that I'd disagree with John; I wish
> >he'd never introduced "=" as a possible assignment).
> >
> >best,
> >-tony
>
> Yup, the S-language does have 3 separate symbols available for 3 separate
> functions ("=" for named arguments, "<-" for assignment, and "==" for
> equality). Like Tony Rossini, I'd rather that these did not
> overlap. Would it be possible to give parse() (and source()) an argument,
> or allow a pragma in a file, that would disallow the use of "=" for
> assignment? (Since "=" was introduced as an assignment operator in S
> implementations, I've been bitten by the bug of a "="/"==" typo a couple of
> times, and have never seen any benefit from the change.)
You can at least make sure you get a run time error by redefining "="
something like
"="<-function(...) stop("'=' used for assignment--I don't like that")
Doing that now has the potential of messing up some packages you might
want to use. R 1.7 should include a name space mechanism that will
let you do this privately within your packages so "=" is disabled for
you but not for other mackages.
luke
--
Luke Tierney
University of Iowa Phone: 319-335-3386
Department of Statistics and Fax: 319-335-3017
Actuarial Science
241 Schaeffer Hall email: luke@stat.uiowa.edu
Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._