Generic functions (objects from or extending class
genericFunction
) are extended function objects,
containing information used in creating and dispatching methods for
this function. They also identify the package associated with the
function and its methods.
Generic functions are created and assigned by
setGeneric
or setGroupGeneric
and, indirectly, by
setMethod
.
As you might expect setGeneric
and
setGroupGeneric
create objects of class
"genericFunction"
and "groupGenericFunction"
respectively.
.Data
:Object of class "function"
, the
function definition of the generic, usually created
automatically as a call to standardGeneric
.
generic
:Object of class "character"
, the
name of the generic function.
package
:Object of class "character"
, the
name of the package to which the function definition belongs
(and not necessarily where the generic function is
stored). If the package is not specified explicitly in the
call to setGeneric
, it is usually the package on which
the corresponding non-generic function exists.
group
:Object of class "list"
, the group or
groups to which this generic function belongs. Empty by default.
valueClass
:Object of class "character"
; if
not an empty character vector, identifies one or more classes. It is
asserted that all methods for this function return objects
from these class (or from classes that extend them).
signature
:Object of class "character"
, the
vector of formal argument names that can appear in the
signature of methods for this generic function. By default,
it is all the formal arguments, except for …. Order
matters for efficiency: the most commonly used arguments in
specifying methods should come first.
default
:Object of class "optionalMethod"
(a union of classes "function"
and "NULL"
), containing
the default method for this function if any. Generated
automatically and used to initialize method dispatch.
skeleton
:Object of class "call"
, a slot used
internally in method dispatch. Don't expect to use it
directly.
Class "function"
, from data part.
Class "OptionalMethods"
, by class "function"
.
Class "PossibleMethod"
, by class "function"
.
Generic function objects are used in the creation and dispatch of formal methods; information from the object is used to create methods list objects and to merge or update the existing methods for this generic.