[Rd] Substitute adds id attribute?

Hadley Wickham hadley at rice.edu
Wed Mar 21 02:05:50 CET 2012


> Well, yes; you can get there more quickly as follows:
>
>> x <- as.name("foo")
>> attr(x,"id") <- 7913
>> x
> foo
> attr(,"id")
> [1] 7913
>> substitute(foo)
> foo
> attr(,"id")
> [1] 7913
>
> I.e. if you ever put an attribute on a symbol, it stays there "forever". The fix is probably to forbid setting attributes on symbols (as we already do for environments and NULL) but I bet that breaks something...

Hmmm, thanks.  No idea what's putting it there, but at least I know
where to start.

Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list