Expand description
S4 OOP system β class registry, method dispatch, and object construction.
S4 is Rβs formal object system. This module implements:
- Class definitions with slots, inheritance, and prototypes (setClass)
- Object construction with slot validation (new)
- Inheritance-aware type checking (is)
- Generic functions and method dispatch (setGeneric, setMethod)
- Slot access and modification (slot, slot<-)
StaticsΒ§
- __
BUILTIN_ πREG_ BUILTIN_ REPRESENTATION - __
BUILTIN_ πREG_ BUILTIN_ SLOT - __
BUILTIN_ πREG_ BUILTIN_ SLOT_ SET - __
INTERP_ πREG_ INTERP_ EXISTS_ METHOD - __
INTERP_ πREG_ INTERP_ IS - __
INTERP_ πREG_ INTERP_ IS_ VIRTUAL_ CLASS - __
INTERP_ πREG_ INTERP_ NEW - __
INTERP_ πREG_ INTERP_ SET_ CLASS_ S4 - __
INTERP_ πREG_ INTERP_ SET_ GENERIC - __
INTERP_ πREG_ INTERP_ SET_ METHOD - __
INTERP_ πREG_ INTERP_ SET_ VALIDITY - __
INTERP_ πREG_ INTERP_ SHOW_ CLASS - __
INTERP_ πREG_ INTERP_ VALID_ OBJECT
FunctionsΒ§
- all_
prototypes_ πfor_ class - Collect all prototype defaults for a class including inherited prototypes.
- all_
slots_ πfor_ class - Collect all slot definitions for a class including inherited slots.
- builtin_
representation π - Create a named character vector describing S4 slot types.
- builtin_
slot π - Extract a slot from an S4 object.
- builtin_
slot_ πset - Set a slot on an S4 object (replacement function).
- extract_
character_ πvec - Extract a character vector from an RValue (for
containsargument). - extract_
prototype π - Extract prototype values from a named list or named vector.
- extract_
slots π - Extract slot definitions from a
representationorslotsargument. Accepts a named list (list(x = βnumericβ, y = βcharacterβ)) or a named character vector (c(x = βnumericβ, y = βcharacterβ)). - inheritance_
chain π - Collect the full inheritance chain for a class, including the class itself.
Uses the S4 class registry to walk the
containshierarchy. - interp_
exists_ πmethod - Check if a method exists for a given generic and signature.
- interp_
is π - Check if an object is an instance of a class (S4-compatible).
- interp_
is_ πvirtual_ class - Check if a class is virtual.
- interp_
new π - Create a new S4 object.
- interp_
set_ πclass_ s4 - Define an S4 class.
- interp_
set_ πgeneric - Define an S4 generic function.
- interp_
set_ πmethod - Register an S4 method.
- interp_
set_ πvalidity - Set a validity method for an S4 class.
- interp_
show_ πclass - Display information about an S4 class.
- interp_
valid_ πobject - Validate an S4 object.