On Wed, Apr 1, 2009 at 4:21 PM, Simon Urbanek
<simon.urba...@r-project.org>wrote:

>
> On Apr 1, 2009, at 15:49 , Stavros Macrakis wrote:
>
>  The documentation for assignment says:
>>
>>    In all the assignment operator expressions, 'x' can be a name or
>>    an expression defining a part of an object to be replaced (e.g.,
>>    'z[[1]]').  A syntactic name does not need to be quoted, though it
>>    can be (preferably by backticks).
>>
>> But the implementation allows assignment to a character string (i.e. not a
>> name), which it coerces to a name:
>>
>>        "foo" <- 23; foo
>>        # returns 23
>>
>>> is.name("foo")
>>>
>>        [1] FALSE
>>
>> Is this a documentation error or an implementation error?
>>
>>  Neither - what you're missing is that you are actually quoting foo
> namely with double-quotes. Hence both the documentation and the
> implementations are correct. (Technically "name" as referred above can be
> either a symbol or a character string).
>

In R, "name" is a technical term, a synonym for "symbol".  Names and
character strings are functionally distinct: eval("foo") is not the same as
eval(quote(foo)), though of course there are cases where R does an implicit
coercion, e.g. list(a=3) / list("a"=3).

I don't see how it makes sense to say "Technically "name" as referred above
can be either a symbol or a character string." except perhaps in the
Humpty-Dumpty sense where a word "means just what I choose it to mean",
which rather defeats the purpose of documentation.

            -s

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to