Form
A Form is a typed surface over a Nu node. It is the third sub-shape of Span, next to Bracket and Policy: it wraps one body, does no work, forwards the body's yield, and gives the body methods (operators, accessors, chains).
List(x).append(v), Str(x).upper(), Int(x) + 1: each call builds an Interaction over the wrapped node and returns a new Form, so the chain keeps going.
Properties
- Own effects: none.
- Children: exactly one body, and it must yield: a Ref, a Query, an Action, or a Span that yields. A Form over a Command or Flow is rejected, there is nothing to put a surface on.
- Yields: exactly what the body yields, in the same shape.
- Runtime: a passthrough. A Form exists for the author, not for the evaluator.
Transparent, like every Span
Parents look through a Form to its body. A Form over an Action is still an Action to its parent, so it composes in a Flow body: ref.set([...]) >> ref.pop() sees the Pop under the Form. A Form over a Query is still a Query.
Cardinality is transparent too. There is no scalar form and stream form: a Form over a scalar is scalar, a Form over a stream is a stream. A stream-shaped surface (map, filter, first, to_list) is just a Form whose methods assume a stream body. A Form over a stream in a scalar slot fails one level up, through the ordinary cardinality rule.
Surface and node
A form family is two parts:
- the node - the Form, a Span. Kind, cardinality, place in the tree. No methods of its own.
- the surface - the method set. No kind, never a node by itself.
The split exists because a Ref and a value share methods. A list Ref and a list value both offer append, len, [i]. Both carry the same surface; the Ref is a Ref node, the value is a Form node. Neither inherits the other's kind.
What lands
A surface offers its whole method set wherever it appears. Whether a call means anything depends on what sits underneath, and the mutation rule decides: a mutation needs an address, otherwise it is a dead end.
Ref - the full face. A Ref is an address, so every method lands: list_ref.append(v), list_ref.pop(), counter.set(0).
Form - the value face. Whatever its body, a Form yields a value, and a value has no address:
- Query methods yield.
Int(5) + 10,Str("hi").upper(). - Action methods are addressless, so they degrade to a Query: the mutation evaporates, the yield survives.
List([1,2,3]).pop()yields3. - Command methods void, and are refused: a Command's mutation slot must hold a Ref.
List([1,2,3]).append(4)is invalid. For a changed value build a new one:List([1,2,3]) + [4].
A Form over a Ref is a value face
List(ref) reads the value at ref and gives it a list surface. It is a read, not a second way to hold the address. A Form is transparent for what it yields, not for the address: a mutation slot needs the Ref itself, with nothing wrapped around it. So List(ref).append(v) is refused like any Command over a value. Write on the Ref: ref.append(v).
The same holds for every Span. Transaction(ref.append(v)) puts the write inside the region; Append(Transaction(ref), v) would resolve the address inside the region and write after it closed, so it is refused too.
Immutability as a policy
There is no mutable / immutable axis in the model. What lands is fixed by what sits under the surface, a Ref or a value. A read-only view of a Ref needs nothing new: wrap it in its Form. The Ref then wears the value face, the yield-only partition applied by choice instead of by necessity.
Unknown surface
When a value's type is genuinely opaque - a dynamically-typed source, an unresolvable annotation - the Form falls back to an unknown surface. Every operation on it returns another unknown-surface Form. The chain never explodes; the user keeps composing. The value-face rule still holds: only yielding operations reach through.
Why a Span
A Form provides the surface, not the work. That is the Span definition: wrap a body, do nothing of its own, forward the yield. Typing a Form as a Query instead would hide its body: a Form over an Action would read as a Query, and a Flow would refuse it.
The model works without Forms - a program can always be written as raw Interactions. Forms make it ergonomic. The node is in the model (a Span sub-shape the rules read), the surface is authoring comfort (methods, no kind), and since a Form is transparent it costs the algebra nothing.