A child holds its ancestors' fields first, so the value of an ancestor is
those fields with the ancestor's type. The fields are the child's own
objects, not copies, and a Rust-stored ancestor's codec builds its state
from them. The result is valid: the child's rules include the
ancestor's, which read the ancestor's fields only. r8convert(x, Parent)
returns the same value, and an impl of the ancestor in compiled code
receives it.
Examples
op <- options(r8.namespace = "demo")
Range <- new_struct("Range", fields = list(lo = type_double(), hi = type_double()))
Window <- new_struct("Window", fields = list(label = type_character()), extends = Range)
r8upcast(Window(lo = 1, hi = 2, label = "w"), Range)#> <demo::Range>
#> lo: 1
#> hi: 2options(op)