Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined replacement function can sometimes immediately modify arg #27

Closed
radfordneal opened this issue Oct 14, 2014 · 1 comment
Closed

Comments

@radfordneal
Copy link
Owner

In pqR-2014-09-30, user-defined replacement functions can sometimes immediately modify their argument, which is fast, but not entirely safe. For example, after

> `f<-` <- function (x,value) { x[1] <- 1; stop("error") }
> a<-numeric(10); a[1] <- 3; f(a) <- 4
Error in `f<-`(a, value = 4) : error
> a
 [1] 1 0 0 0 0 0 0 0 0 0

we see that a[1] has changed even though the replacement function exited with an error.

This is the result of a combination of a[1] <- 3 letting "a" get a NAMEDCNT of 0, which is generally unnoticeable since it is fixed up later, and invokation of user-defined replacement functions not doing the usual fixup. These problems are now corrected in development branch 30.

@radfordneal
Copy link
Owner Author

Now fixed in pqR-2014-10-23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant