Skip to main content

Module s4

Module s4 

Source
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 contains argument).
extract_prototype πŸ”’
Extract prototype values from a named list or named vector.
extract_slots πŸ”’
Extract slot definitions from a representation or slots argument. 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 contains hierarchy.
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.