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

Don't embed external generics #389

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# S7 (development version)

* `method<-` now returns an external generic when inside a package and defining
a method for a generic not found inside the package. This ensures that your
package end up with a copy of a generic from another package inside of it
(#364).

* S7 provides a new automatic backward compatibility mechanism to provide
a version of `@` that works in R before version 4.3 (#326).

Expand Down
1 change: 0 additions & 1 deletion R/method-register.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#' bizarro(head(mtcars))
`method<-` <- function(generic, signature, value) {
register_method(generic, signature, value, env = parent.frame())
invisible(generic)
}

register_method <- function(generic,
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-method-register.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("method registration", {
expect_equal(sum(foo2()), "foo")

# and doesn't modify generic
expect_equal(sum, base::sum)
expect_equal(sum, new_external_generic("base", "sum", "__S3__"))
})

it("can register S7 method for S3 Ops generic", {
Expand Down
Loading