-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
The following attempt at making a unary method for - fails:
library(S7)
foo <- new_class("foo")
method(`-`, list(foo, class_missing)) <- function(e1, e2) {"Minus foo"}
-foo()
#> Error in Ops.S7_object(foo()): argument "e2" is missing, with no defaultCreated on 2025-03-28 with reprex v2.1.1
I think the cause is that the following lines don't consider the possibility of missing e1 or e2.
Lines 19 to 22 in db59642
| cnd <- tryCatch( | |
| return(base_ops[[.Generic]](e1, e2)), | |
| S7_error_method_not_found = function(cnd) cnd | |
| ) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels