Skip to content

Group generics #353

Closed
Closed

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)))
}

Activity

  1. added this to the v0.2.0 milestone on Oct 17, 2023
  2. modified the milestones: v0.2.0, v0.3.0 on Sep 16, 2024
  3. hadley commented on Jul 6, 2026

    @hadley
    MemberAuthor

    Now discussing in #506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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