Can please someone familiar with the R internals enlighten me on the
following strange observation:
# this is IDENTICAL as expected
identical(substitute(substitute()), substitute(substitute()))
# but NOT EQUAL !????
substitute(substitute()) == substitute(substitute())
# I originally found it on
t2 <- function(e){
substitute(e)
}
t2(substitute(x==y, list(y=y)))[1]
# I would expect all of the following to be equal !?
t2(substitute(x==y, list(y=y)))[1] == substitute(substitute())
t2(substitute(x==y, list(y=y)))[1] == substitute(substitute())[1]
identical(t2(substitute(x==y, list(y=y)))[1], substitute(substitute())[1])
identical(t2(substitute(x==y, list(y=y)))[1], substitute(substitute()))
identical(t2(substitute(x==y, list(y=y)))[1], quote(substitute()))
I have a guess that .Primitive("==") on method dispatch somehow treats its
first argument different from its second. However, if so, is this intended? Or
is it an unavoidable implementation issue? Or a bug?