Re: [Rd] potential bug in attribute handling for externalptr

2017-04-15 Thread Jeroen Ooms
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

Re: [Rd] potential bug in attribute handling for externalptr

2017-04-15 Thread Lionel Henry
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

[Rd] potential bug in attribute handling for externalptr

2017-04-14 Thread Patrick Perry
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.