Skip to main content

Module altrep_traits

Module altrep_traits 

Source
Expand description

Safe, idiomatic ALTREP trait hierarchy mirroring R’s method tables.

§Design: Required vs Optional Methods

Each ALTREP type family has:

  • Required methods (no defaults) - compiler enforces implementation
  • Optional methods with HAS_* const gating - defaults to false (not installed)

When HAS_* is false, the method is NOT installed with R, so R uses its own default behavior.

§Required Methods by Type

TypeRequired Methods
Alllength
ALTSTRINGlength + elt
ALTLISTlength + elt
Numeric typeslength + (elt OR dataptr via HAS_*)

Enums§

AltrepGuard
Controls the panic/error guard used around ALTREP trampoline callbacks.

Constants§

KNOWN_UNSORTED
Known to be unsorted (KNOWN_UNSORTED in R).
NA_INTEGER
NA value for integers.
NA_LOGICAL
NA value for logical (same as integer in R).
NA_REAL
NA value for reals (IEEE NaN with R’s NA payload).
SORTED_DECR
Sorted in decreasing order, possibly with ties (SORTED_DECR in R).
SORTED_DECR_NA_1ST
Sorted in decreasing order, with NAs first (SORTED_DECR_NA_1ST in R).
SORTED_INCR
Sorted in increasing order, possibly with ties (SORTED_INCR in R).
SORTED_INCR_NA_1ST
Sorted in increasing order, with NAs first (SORTED_INCR_NA_1ST in R).
UNKNOWN_SORTEDNESS
Unknown sortedness value (INT_MIN in R).

Traits§

AltComplex
Complex vector methods.
AltInteger
Integer vector methods.
AltList
List vector methods.
AltLogical
Logical vector methods.
AltRaw
Raw vector methods.
AltReal
Real vector methods.
AltString
String vector methods.
AltVec
Vector-level methods.
Altrep
Base ALTREP methods.