You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a consumer, checked against main aa55826. Adopted by the user (2026-11-23) as a design note for approval, after #482. No code before the note is approved.
Today: a rule body is Arc<dyn Fn(Tw, &Tokens) -> Tw> (sheet.rs:181), a closure only so it can read tokens late. So Sheet compares by pointer (Arc::ptr_eq, :251) and keeps a version counter for the build memo, and Style lost PartialEq in #435. The generated bodies are straight Tw chains. Their only token operations are alpha (gamma_multiply, 340 uses) and colour mix (8).
The idea:
Tw's colour, length and text properties hold Value<T> = Lit | Token(TokenRef) | Op(alpha, mix, scale, offset, min-with-literal).
A rule body becomes a Tw value; tokens are substituted as resolution's last step.
Sheet/Style derive Clone, Debug, PartialEq, Hash (with serde behind a feature), and the pointer equality and version go.
A rule_fn escape hatch while migrating, with its uses counted (goal: zero).
What it gives:
content equality;
themes and App rules in files (hot reload, tweakcn import, a resolved style saved beside goldens);
an inspector that names the token.
The note must settle:
the Tw size: a sheet Tw and a resolved Tw, or a side table for token refs;
Order: after the metric tokens issue and #482, so those sheets are converted once. Relates to #468 (tw!/Tw::parse, which would produce values directly).
Activity