Skip to content

Group generics #353

@hadley

Description

@hadley

Related to #320, we need some way to register methods for group generics. I think the syntax should probably look something like this?

library(S7)
foo <- new_class("foo", class_integer)
method(Math, foo) <- function(x) {
   foo(Math(super(x, class_integer)))
}
method(Ops, list(foo, class_any)) <- function(x, y) {
   foo(Ops(super(x, class_integer), y))
}
method(Ops, list(class_any, foo)) <- function(x, y) {
   foo(Ops(x, super(y, class_integer)))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions