Multiple packages may define methods for the same function, to apply
to classes defined in that package. Arithmetic and other operators,
plot() and many other basic computations are typical
examples. It's essential that all such packages write methods for
the same definition of the generic function. So long as that
generic uses the default choice for signature and other parameters,
nothing needs to be done.
If the generic has special properties, these need to be ensured for
all packages creating methods for it. The simplest solution is just
to make the function generic in the package that originally owned
it. If for some reason the owner(s) of that package are unwilling
to do this, the alternative is to define the correct generic,
save it in a special table and restore the non-generic version by
Note that the package containing the function can define methods for the implicit generic as
well; when the implicit generic is made a real generic, those methods
will be included.
The usual reason for having a
non-default implicit generic is to provide a non-default signature,
and the usual reason for that is to allow lazy evaluation of
some arguments. All arguments in the signature of a
generic function must be evaluated at the time the function needs to
select a method.
In the base function
with() in the example below, evaluation of the argument
expr must be delayed; therefore, it is excluded from the signature.
If you want to completely prohibit anyone from turning your function
into a generic, call
implicitGeneric() returns the implicit generic
version of the named function. If there is no table of these or if
this function is not in the table, the result of a simple call
setGeneric(name) is returned.