Builds a getter/setter property that reads and writes an inherited property
under a different name – how timescales::Calendar keeps @timeframes and
geoscales::Geoscale keeps @geoframes working over the inherited
@frames, so no existing code has to change when they become subclasses.
scale_alias_property(name)An S7 property.
The setter is a no-op on NULL. S7's generated constructor writes every
dynamic property once with NULL before the real values are set, so a
setter that forwards NULL makes the class impossible to construct.
Aliased <- S7::new_class("Aliased",
parent = scale_class(),
properties = list(levels = scale_alias_property("frames"))
)
a <- Aliased(
leaftable = scale_leaftable(scale_example()),
frames = scale_frames(scale_example()),
members = S7::prop(scale_example(), "members")
)
a@levels
#> [1] "sector" "class" "group" "unit"