Gabor Grothendieck <[EMAIL PROTECTED]> writes: > This leads to additional questions: > > - is it desirable to make it easy to work with non-synactic names?
No and yes. This has been the reason thant it wasn't implemented long ago, but the increasing use of interfaces to non-R databases (with non-R names) was making it desirable to have some way of using these names, particularly in model formulas. Notice that non-valid names have always been supported for function names and list elements. > - if the previous point is yes, then is this use sufficiently > important to warrant a new syntactic element, viz. backquote? > For example, extending perhaps as.name could be extended so that > it can be used on the left hand side of an assignment like this: > as.name("height in m2")^2 or as.name("weight in kg")[101]<-55 get() would be more likely than as.name() there since it doesn't make sense to square a symbol and y <- as.name("x") is different from y <- get("x"). That would be workable, but it introduces an extra function call at run time and leads to notation in model formulas which would drive users nuts. Also it has the potential to rid us of some unfortunate assymmetries in the language where text strings in "non-syntactic" positions - but only there - are used to specify funny names. Consider e.g. "foo bar" <- x vs. x <- "foo bar". Much of this would be more logical if the identifier was put in backticks rather than quotes. On the other hand compatibility issues probably forces us to live with the old convention in dump() and similar places. > - how far can this feature be pushed? For example, backtick quoted > names might be usable in string literals as in perl: > print("variable x is `x` and variable y is `y`") or > download.file("http://www.xyz.com?a=`a`&b=`b`") I wouldn't want to push it very far, and quite certainly not in that direction (having backticks mean "value of" in one context and "literal name" in another would be odd). It works at the level of lexical analysis, so it is a very basic element, similar to the %foobar% style of operator specification (there's one type of funny name for you that has been integral to the language for quite a while.) Of course, one could still implement string interpolation; it's just not really related to the issue of nonstandard identifiers. > I am not sure what the answers to these questions should be > but in order to combat excessive growth of the syntax a new > syntax addition usually is made to climb a higher barrier than > a feature which does not. Actually, the ASCII character set puts a rather effective limit on the number of quoting operators that one can have. The backtick was the only symbol that wasn't already used in R, so bringing it into play *was* considered quite carefully... -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel