8000 Embedding generics when defining methods · Issue #364 · RConsortium/S7 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Embedding generics when defining methods #364
Open
@hadley

Description

@hadley
library(S7)
foo1 <- new_class("foo1", properties = list(x = class_integer))
foo2 <- new_class("foo2", foo1, properties = list(y = class_double))

method(convert, list(foo1, class_integer)) <- function(from, to) {
  from@x
}
ls()
#> [1] "convert" "foo1"    "foo2"

I think this is going to be a problem because defining a method for a generic defined in another package will end up embedding a copy of that generic in your package. Not sure what we can do here given that this is a fairly deep seated behaviour of <- functions.

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

      0