order-mixed-join-stored-promise.ts 967 B

12345678910111213
  1. // A stored promise joined with a freshly-issued one. This is the case phase 1 got WRONG
  2. // rather than merely imprecisely: the awaited expression ISSUES the fresh ask, so the
  3. // syntactic rule found a non-empty settle set and the barrier never widened — and `held`,
  4. // whose promise this same `await` genuinely waits for, was never settled at all. The
  5. // picture left it incomparable with the trailing step, i.e. it invented concurrency the
  6. // script does not have, which is the one direction the design promises never to take.
  7. // Phase 2's oracle settles it; the claim is `maybe` because a two-witness join set cannot
  8. // be told apart from `Promise.race`, which settles exactly one of its inputs.
  9. // Expect: ask#1 -> ask#3 seq maybe, ask#2 -> ask#3 seq always.
  10. const held = agent("slow").ask<string>("A");
  11. const [x, y] = await Promise.all([held, agent("fresh").ask<string>("B")]);
  12. const after = await agent("after").ask<string>("C");
  13. return `${x} ${y} ${after}`;