Expand description
S4 class wrapper generator (setClass / setMethod formal OOP).
S4-class R wrapper generator.
Generates methods::setClass(...) with an externalptr slot, plus
methods::setGeneric / methods::setMethod for each instance method.
Supports formal slot validation, multi-dispatch on method signatures,
and contains-based inheritance — the only system here with native
multi-dispatch. Cost: slowest dispatch path, all helpers live in the
methods:: namespace (methods must be imported, not base), and the
ecosystem is increasingly legacy. Pick S4 for Bioconductor interop;
use S7 for new packages wanting similar formal semantics.
Functions§
- generate_
s4_ class - Generates the R wrapper of an S4-style class, in the parts the wrapper
writer merges per type (
super::ClassWrapper, #1776). - s4_
generic_ 🔒guard - The line that defines an S4 instance method’s generic before its
setMethod(), shared by the inherent and trait generators. - s4_
generic_ 🔒name - The S4 generic an instance method dispatches through: an explicit
s4(generic = "...")verbatim, elses4_<R method name>, sor_name,postfixand raw identifiers follow the usual naming rules. Shared by the generator andcheck_s4_generic_collisions, so both agree on the names.