I think it is related to the call to duplicate in do_attach:
defineVar(TAG(p), duplicate(CAR(p)), s);
You can circumvent it by using "importIntoEnv", as in:
> e <- new.env()
> makeActiveBinding('x',function() 'foo',e)
> f <- new.env()
> attach( f, pos = 2 )
> .Internal(importIntoEnv( as.environment(2), ls(e), e, ls(e) ))
[1] "foo"
Romain
On 11/05/2009 04:53 PM, Jeffrey Horner wrote:
Hi,
Is this expected behavior for active bindings in attached
environments, or is this a bug:
e<- new.env()
makeActiveBinding('x',function() 'foo',e)
ls(e)
[1] ".GlobalEnv" "e" "package:graphics"
[4] "package:grDevices" "package:datasets" "package:utils"
[7] "package:methods" "Autoloads" "package:base"
function() 'foo'
Should this print 'foo' ? The following works as I would expect:
[1] "foo"
but this doesn't:
function() 'foo'
However, changing the environment of f does: