Skip to main content

Module s4_class

Module s4_class 

Source
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_r_wrapper
Generates the complete R wrapper string for an S4-style class.