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 tofalse(not installed)
When HAS_* is false, the method is NOT installed with R, so R uses its own default behavior.
§Required Methods by Type
| Type | Required Methods |
|---|---|
| All | length |
| ALTSTRING | length + elt |
| ALTLIST | length + elt |
| Numeric types | length + (elt OR dataptr via HAS_*) |
Enums§
- Altrep
Guard - Controls the panic/error guard used around ALTREP trampoline callbacks.
Constants§
- KNOWN_
UNSORTED - Known to be unsorted (
KNOWN_UNSORTEDin 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_DECRin R). - SORTED_
DECR_ NA_ 1ST - Sorted in decreasing order, with NAs first (
SORTED_DECR_NA_1STin R). - SORTED_
INCR - Sorted in increasing order, possibly with ties (
SORTED_INCRin R). - SORTED_
INCR_ NA_ 1ST - Sorted in increasing order, with NAs first (
SORTED_INCR_NA_1STin 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.