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

  1. Static hoisting. Detect fully-static subtrees; create them once, not per render. Measure.
  2. Patch flags. Annotate which bindings are dynamic; make your fw-05 renderer honour them and skip prop enumeration and children diffing accordingly. Measure.
  3. 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.
  4. For each break, note that nothing threw. That is the defining risk of compiler optimisation.
  5. 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