-
Notifications
You must be signed in to change notification settings - Fork 37
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
Weird S7/S3 interaction in $()
#390
Comments
Oooh I wonder if this is #389 — it might be but that PR alone is not enough (and also it seems to cause a problem when unregistering methods with pkgload). But running You also get the correct result with |
I quickly tried that PR and it doesn't seem to solve the interaction. .onLoad <- function(...) {
methods_register()
registerS3method("$", "bar", `$.bar`)
} Then it behaves as it should, but I don't know enough about the innards of S7 to speculate why this works.
That does seem consistent with the observed behaviour. |
Ok so it looks like the mere presence of Minimal reprex of the S3 issue: #' A foo object
#' @export
foo <- function(x) {
structure(list(), class = "foo")
}
#' @export
`mean.foo` <- function(...) {
"FOO"
}
`mean` <- NULL That means back to the drawing board. |
This is similar to the problem we encountered with S3method(base::`@`, S7_object) |
I found that defining a
$
-method for an S7 class negates another$
-method for an S3 class.I could not reproduce this in an interactive session, so I build a small package to demonstrate the weird interaction.
Please see the README of https://github.com/teunbrand/s7bugreport/ for details.
The text was updated successfully, but these errors were encountered: