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

example 13.4.4(5) does not work as described for R 4.4.x #1788

Open
JeffreyASmith opened this issue Jun 12, 2024 · 1 comment
Open

example 13.4.4(5) does not work as described for R 4.4.x #1788

JeffreyASmith opened this issue Jun 12, 2024 · 1 comment

Comments

@JeffreyASmith
Copy link

R version 4.3.3 (2024-02-29 ucrt) -- "Angel Food Cake"
g <- function(x) {
x <- 10
y <- 10
UseMethod("g")
}
g.default <- function(x) c(x = x, y = y)
x <- 1
y <- 1
g(x)
x y
1 10

Same code and variables under R version 4.4.0 (2024-04-24 ucrt) -- "Puppy Cup"
g(x)
y
1 1

@yeyuan98
Copy link

R NEWS stated this change effective for version 4.4.0

"UseMethod() no longer forwards local variables assigned in the generic function into method call environments before evaluating the method body. This makes method calls behave more like standard function calls and makes method code easier to analyze correctly."

https://cran.r-project.org/doc/manuals/r-release/NEWS.html

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

2 participants