fw-06 step 02 — Hoisting, patch flags, and silent failure
Goal
Add the optimisations that justify a compiler, then demonstrate that each one fails silently when wrong.
Tasks
- Static hoisting. Detect fully-static subtrees; create them once, not per render. Measure.
- Patch flags. Annotate which bindings are dynamic; make your
fw-05renderer honour them and skip prop enumeration and children diffing accordingly. Measure. - Break each one:
- hoist a subtree that actually reads a dynamic value → stale render;
- mark a dynamic node static → the update never appears, with no error;
- share a hoisted node that is then mutated → cross-instance leak.
- For each break, note that nothing threw. That is the defining risk of compiler optimisation.
- Design the safety net. Run the same test suite with optimisations on and off, comparing output. This is Chromium's virtual-test-suite idea applied to a compiler.
Done when
- Hoisting and patch flags implemented and measured
- All three silent failures reproduced
- An on/off differential test harness exists