Skip to main content

Module s7_class

Module s7_class 

Source
Expand description

S7 class wrapper generator (new_class / new_generic modern R OOP). S7-class R wrapper generator.

Generates S7::new_class(...) with value semantics, formal property validation, and parent-based inheritance. Property attributes (s7(getter) / s7(setter, prop = "...")) compile to S7::new_property with @-access semantics, including read-only computed properties and read-write dynamic ones. Similar formal power to S4 with cleaner syntax, but the S7 ecosystem is younger and the R-package dependency surface is evolving. Pick S7 for new packages wanting modern formal OOP (including multiple dispatch); use S4 when you need Bioconductor compatibility.

EnumsΒ§

S7GenericTarget πŸ”’
Where an S7 instance method’s generic comes from.

ConstantsΒ§

S7_BASE_S3_OPERATORS πŸ”’
Operators base R always provides and S7 dispatches on the receiver alone (through the base primitive as an S3 generic).
S7_OPS_OPERATORS πŸ”’
R’s Ops group operators. S7 dispatches them on both operands through its own (e1, e2, ...) generics.

FunctionsΒ§

class_ref_or_any_or_verbatim πŸ”’
S7-property variant of class_ref_or_verbatim that asks the resolver to fall back silently to S7::class_any on miss (unregistered type, or a registered-but-non-S7 class). Prevents the load-time object not found noise called out in #203.
emit_s7_local_generic πŸ”’
Emit the load-time definition of a package-local S7 generic: define it when no binding exists, shadow a plain (non-generic) function, otherwise reuse the existing generic.
extract_prop_doc_from_tags πŸ”’
Extract the full property documentation from a getter’s doc_tags for use in @prop <name> <doc> emission.
generate_s7_class
Generates the R wrapper of an S7-style class, in the parts the wrapper writer merges per type (super::ClassWrapper, #1776).
r_chr_vector πŸ”’
A character vector literal: "x" or c("x", "y").
rust_type_to_s7_class πŸ”’
Map a Rust return type to an S7 class name.
s7_base_operator_unbind πŸ”’
The line that follows an S7::method(<op>, ...) <- registration on a base operator: base::rm(list = "<op>").
s7_dispatch_args πŸ”’
The S7 dispatch arguments of an instance method: s7(dispatch = "a, b"), else the pair an operator generic fixes (e1, e2), else x.
s7_generic_target πŸ”’
Classify a method’s generic name (ctx.generic_name()).
s7_method_signature πŸ”’
The S7::method() signature: the class (or S7::class_any for a fallback) for the receiver, and S7::class_any for every other dispatch argument.
s7_operator_dispatch_args πŸ”’
The dispatch arguments S7 fixes for a two-operand operator generic: (e1, e2) for the Ops group, (x, y) for %*% (the matrixOps group).
s7_shortcut_name πŸ”’
Name of the S7 fast-path shortcut <ClassName>_<method> (#949), or None when that name is not a syntactic R name.
shortcut_advisory_lines πŸ”’
Roxygen prose for the fast-path dispatch shortcut advisory block.