Skip to contents

Returns the function that implement() or impl() declared for a type, or for a tuple of types of a generic that dispatches on several arguments, for tests and inspection.

Usage

r8method(...)

Arguments

...

The generic, without an argument name, then the types, as implement() takes them: one R8 type object, or one per dispatched argument, by position or by name.

Value

Function. A generic without a method for the types raises r8_dispatch_error.

Examples

op <- options(r8.namespace = "models")
GBM <- new_struct("GBM", fields = list(n_trees = type_integer(min = 1L)))
describe <- generic("describe", params(x))
implement(describe, GBM) <- function(x) "Gradient boosting"
r8method(describe, GBM)
#> function (x) 
#> "Gradient boosting"
#> <environment: 0x7c3c836c48>
options(op)