On Tue, 2 Sep 2003, Richard A. O'Keefe wrote: > For reasons which I'll spare you, I'm writing a program to analyse > R source code. This has led me to probe some of the darker corners > of R syntax to find out what is supposed to happen. > > Now, from reading the R documentation (and the New S book &c) I know > perfectly well that > f(a, b, etc) <- x > is supposed to turn into > a <- "f<-"(a, b, etc, value=x) > > Except, what if f is not an identifier or string? > What, for example, should _this_ do? > > > x <- NULL > > (if (TRUE) names else dim)(x) <- 27 > > I was expecting _either_ that I would be told that you can't > set names(NULL) to 27, _or_ that I would be told the whole thing > wasn't allowed. > > In fact, it was allowed. > > > x > [1] 27 > > This result has me completely baffled. > > Is this behaviour intentional?
No. Using anything other than a symbol or string for the function in a complex assignment is an error. The internals assumed the function would be a symbol (the parser deals with the string case) but did not check for this; should be fixed shortly in R-devel. Thanks for pointing this out. luke -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help