Conversation
|
To do:
|
#Conflicts: # NAMESPACE # R/method-ops.R # R/zzz.R
|
@t-kalinowski @DavisVaughan before I finish up the implementation for the other group generics, could you please take a look at how it works for Math? |
| S7_error_method_not_found = function(cnd) NULL | ||
| ) | ||
|
|
||
| NextMethod() |
There was a problem hiding this comment.
Do we need to call NextMethod()? Isn't S7_object always the right-most class? It would be nice to throw the S7 method not found error if we could
| @@ -16,17 +16,24 @@ on_load_define_ops <- function() { | |||
|
|
|||
| #' @export | |||
| Ops.S7_object <- function(e1, e2) { | |||
There was a problem hiding this comment.
Should this all live in method-group.R now?
| } | ||
|
|
||
| #' @export | ||
| Math.S7_object <- function(x, ...) { |
There was a problem hiding this comment.
Do you also need to check for a "specific" generic call here?
t-kalinowski
left a comment
There was a problem hiding this comment.
This looks like a very nice solution. I see no issues.
|
Sorry if I'm a "game spoiler": Using |
|
If you can suggest an alternative implementation, I'm happy to try it. But I couldn't think of another way to do it. |
|
One approach might be to update S7_Math <<- new_generic("Math", "x", function(x, ..., .Generic) {
cl <- .Call(method_call_, sys.call(), sys.function(), sys.frame())
if(is.null(cl))
NextMethod()
else
eval(cl)
}) |
"Nice"! That would almost surely be an order of magnitude faster! Possibly we'd even want to provide (and document and use ourselves) a thin wrapper around |
|
Ok, I'll take a stab at that approach. |
Fixes #353