Open JeffreyASmith opened 4 months ago
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."
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