Skip to contents

The parents of a struct through extends, the nearest first. A child's values belong to the class of each ancestor, and an impl of an ancestor applies to them where the child has none.

Usage

r8ancestors(type)

Arguments

type

An R8 struct type object, or a value of one.

Value

Character: The qualified names of the ancestors; empty for a struct without extends. A stale struct, which extends an earlier declaration of its parent, raises r8_type_error.

Examples

op <- options(r8.namespace = "demo")
Range <- new_struct("Range", fields = list(lo = type_double(), hi = type_double()))
#> Warning: The declaration of `demo::Range` leaves `demo::Window` stale: it extends an earlier declaration. Declare it again, parent before child.
Window <- new_struct("Window", fields = list(label = type_character()), extends = Range)
r8ancestors(Window)
#> [1] "demo::Range"
options(op)