On Fri, Apr 14, 2017 at 11:27 PM, Patrick Perry wrote:
> Is the following expected behavior? I would expect that modifying y's
> attributes should not affect x.
Yes this is expected. Environments and external-ptr objects are never
copied on assignment, hence in your example 'x' and 'y' are the s
This is expected behaviour, pointers are an uncopyable type, just like
environments:
env <- new.env()
env
#>
structure(env, foo = "bar")
env
#>
#> attr(,"foo")
#> [1] "bar"
On Fri, Apr 14, 2017 at 11:27 PM, Patrick Perry
wrote:
> Is the following expected behavior?
>
> > mkext <- inline::cf
Is the following expected behavior?
> mkext <- inline::cfunction(language="C", body='return
R_MakeExternalPtr(NULL, install("tag"), R_NilValue);')
> x <- mkext()
> y <- x
> attr(y, "foo") <- "bar"
> attributes(x)
$foo
[1] "bar"
I would expect that modifying y's attributes should not affect x.