You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parser tries to attach "id" attributes to symbols and NULLs. However, a "symbol" is, like an environment, only a reference to a single global entity (even though the symbol will be interpreted differently according to context when R is executing code containing it). Thus, putting an attribute on one instance of 'x' will put the same attribute on ALL occurrences of 'x'!
the example below looks funny because Git has decided to apply "git-flavoured markdown" to it, but the point should be clear... Example:
p <- parser( text='x;x')
p[[1]]
x
attr(,"id")
[1] 8
p[[2]]
x
attr(,"id")
[1] 8
Uh-oh; p[[2]] shouldn't have same tag (id attr) as p[[1]]! Look-up now doesn't work.
quote( x)
x
attr(,"id")
[1] 8
Big uh-oh; the symbol 'x' has globally acquired a tag!
Also, parser( text='NULL') tries to put a tag on the NULL but can't, because NULL can't have attributes. Again, there is only one "NULL" .
My suggested solution is not to tag each element directly, but instead to tag its parent element with a vector of child tags, one element for each child. NULL and symbols can't have children, so this will never try to tag illegal things AFAICS.
The text was updated successfully, but these errors were encountered:
parser tries to attach "id" attributes to symbols and NULLs. However, a "symbol" is, like an environment, only a reference to a single global entity (even though the symbol will be interpreted differently according to context when R is executing code containing it). Thus, putting an attribute on one instance of 'x' will put the same attribute on ALL occurrences of 'x'!
the example below looks funny because Git has decided to apply "git-flavoured markdown" to it, but the point should be clear... Example:
Also, parser( text='NULL') tries to put a tag on the NULL but can't, because NULL can't have attributes. Again, there is only one "NULL" .
My suggested solution is not to tag each element directly, but instead to tag its parent element with a vector of child tags, one element for each child. NULL and symbols can't have children, so this will never try to tag illegal things AFAICS.
The text was updated successfully, but these errors were encountered: