functions-summaries-bind-self-rebind.ts 844 B

12345678910111213
  1. // Self-rebinding a function value: `h = h.bind(null, "x")` appends one element to h's bind
  2. // prefix on EVERY fixpoint pass, so the value grew in LENGTH rather than in nesting depth —
  3. // VALUE_DEPTH_CAP never fired, mergeBound kept extending the prefix element-wise and
  4. // reported `changed` forever (the ITERATION_CAP throw). The prefix LENGTH is capped now, and
  5. // an over-cap element degrades into the value's occurrences (a smear, never a drop).
  6. // Expected: the flow through the eventual call survives the cap — ask#1 -> ask#2 data
  7. // inexact (a bound dispatch never proves its alignment); ask#2 -> sink.
  8. function joinParts(...parts: string[]): string {
  9. return parts.join("");
  10. }
  11. let h: (...parts: string[]) => string = joinParts;
  12. h = h.bind(null, "x");
  13. return agent("reader").ask<string>(`${h(await agent("a").ask<string>("s"))}`);