functions-summaries-bind-merge-alignment.ts 1.1 KB

12345678910111213141516171819202122
  1. // Merge-trap regression for the bind prefix (RC4, round-3 addendum). `h` is a union of a
  2. // PLAIN function and a BOUND one (`f.bind(null, pre)`), so its value carries fns={plain, f}
  3. // plus bound=[pre] — but the set can't say which fn owns the prefix. `h(later)` must reach
  4. // every runtime alignment:
  5. // - plain's param x = later (h === plain: no prefix prepended)
  6. // - f's param a = pre, param b = later (h === bound: prefix [pre] prepended, then later)
  7. // Dropping the no-prefix alignment loses `later -> plain`'s ask; dropping the prefix
  8. // alignment loses `pre -> f`'s ask and `later -> f`'s ask (param b). Dual application keeps
  9. // all three (plus sound spurious cross-edges). Bound dispatch is inexact.
  10. const judge = agent("judge");
  11. const pre = await agent("p").ask<string>("pre");
  12. const later = await agent("l").ask<string>("later");
  13. function plain(x: string): Node<string> {
  14. return judge.ask<string>(`plain ${x}`);
  15. }
  16. function f(a: string, b: string): Node<string> {
  17. return judge.ask<string>(`f ${a} ${b}`);
  18. }
  19. const flag = Date.now() % 2 === 0;
  20. const h = flag ? plain : f.bind(null, pre);
  21. const out = await h(later);
  22. return out;