functions-summaries-bind-partial.ts 560 B

123456789101112
  1. // g = f.bind(null, secret); g() — at runtime g() is f(secret): secret flows into
  2. // ask#2 and the ask result flows to the sink. The bind call misaligns actuals
  3. // (param 0 <- null) AND the bound function value g carries only f's substituted
  4. // summary (no .fns), so the later g() is an unknown call returning nothing.
  5. const judge = agent("judge");
  6. const secret = await agent("s").ask<string>("make secret");
  7. function f(x: string): Node<string> {
  8. return judge.ask<string>(`judge ${x}`);
  9. }
  10. const g = f.bind(null, secret);
  11. const out = await g();
  12. return out;