This is a bug in R: it either should prohibit the
attaching of attributes to things of class "name"
or should make it so that attachment of an attribute
doesn't have such a global effect.

A more direct example of the problem is:
  > attributes(quote(some.name))
  NULL
  > bar <- structure(quote(some.name), someAttribute="someAttribute's value")
  > attributes(quote(some.name))
  $someAttribute
  [1] "someAttribute's value"

I reported a similar problem to R-devel in March of
2010 under the subject line "symbol name caching bug:
attributes get tied to symbol names".  The consensus
then seemed to be that prohibiting attributes on things
of class "name" was the way to go.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf Of Kamil Barton
> Sent: Monday, November 21, 2011 8:31 AM
> To: r-help@r-project.org
> Subject: [R] Weird R's behaviour with a quoted name
> 
> Can someone explain why the following happens?
> ---
> :> quote(some.name)
> some.name
> :> bar <- structure(quote(some.name), class = "foo")
> :> quote(some.name)
> Error in print(some.name) : object 'some.name' not found
> :> bar <- quote(some.name)
> :> quote(some.name)
> Error in print(some.name) : object 'some.name' not found
> :> bar <- as.name("some.name")
> :> quote(some.name)
> some.name
> ---
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to