Attach
attach($key, Child::class)
A fixed child: its keys are stored as a map under the key, behind the wall, and refined and validated in its own frame.
Surface API visuals · 5 of 7
attach($key, Child::class)
A fixed child: its keys are stored as a map under the key, behind the wall, and refined and validated in its own frame.
attachVariants($key, by: $sibling)
A tagged union whose tag is a sibling key: one structure per value, and the chosen variant's keys are stored under the key.
mixIn(Structure::class)
A structure whose members are merged into the owner's own keys: stored flat, refined in the owner's frame.
reads($port, $type) and attach(..., reads:)
A value a structure reads from its container under a name of its own: a live sibling value, never stored or drawn by the structure.
attachList($key, Child::class, min:, max:)
A list of child instances at a key: the list and its Count are the parent's, and each item is the child's.
addEach() and attachEach()
One key per thing the site has, in a map at a key, listed by a provider at every build.
A resource or structure is made of others in six ways, and each keeps the keys in a different place. Nest for a thing of its own, mix in for shared members that are part of this thing, and read a port for a value the container holds. Use variants when a key chooses the keys, a collection when groups repeat, and keys from the site when the site, not the code, decides how many there are.
Read more Which way to compose, Children, Keys that come from the site. Decisions Variants, not slots, A port is a live sibling value, A mixin is merged flat, A list of child invocations, Keys that come from the site.
Part of Surface API; see the full explainer.