Derived attributes
Read-only values a construct computes while it renders — what publishes them, and why they cannot be substituted.
#What a derived attribute is
Some constructs compute something as they render — a fit's slope, an integral's area, the value a reader has dragged a parameter to. Those results are published as derived attributes: read-only, recomputed every frame, and never written by the author. They are listed in their own section on the reference page of any construct that has them.
#Reading one
By member access on the construct's id. In attribute position the binding is written directly; in prose it is wrapped in !value, because a reference written bare in a body compiles as literal text.
text(x: 0; y: 4; label: slope = #f.slope) in an attribute — a binding
The fitted slope is !value:#f.slope(digits: 2). in prose — a micronodeWhat publishes them today:
- fit —
slope,intercept,r2. The slope is the fitted polynomial's derivative at zero: exact, and live under whichever degree the reader has chosen. - curve —
maxandminover the plotted domain. - integral —
value, the computed area. - parameter —
value, wherever the reader has left the slider. - contour and heatmap —
minandmaxover the visible window.
#Why they refuse substitution
{{#fit.slope}} is a compile error, and deliberately so. A substitution is a snapshot spliced into the source before parsing; a derived value is whatever the render currently computes. Freezing one into the document would let the prose assert a number the picture beside it disagrees with — which is the exact failure this machinery exists to prevent.
#What publishes them
The construct itself, from inside the renderer, once per frame. Nothing an author writes can add a derived attribute to a construct that does not declare one, and nothing can set one — an attempt to assign #f.slope is an error, not a silent override. Existence is still proven at compile time: a reference to a derived name the construct does not publish fails before anything renders.