Home / Learn / 15 Concurrency and parallelism

Release v0.4.0Edition 0.2

15.8 Recap and reference

Page 9 of 9

15.8.1 For agents

una --json check . prints each diagnostic of this chapter with its code, message and primary span; none carries a repair edit, so the document reports "fixable":0, and una fix changes nothing. U2023 marks the outer name a task assigns; U2024 marks together, with each line of the block that is not a let; U0101 marks together or together for where it stands; U0103 marks async or await. In una --json test ., an example's trace lists the events of a block's tasks in task order, each event with its task's path in task. The compact rule: a together block or a together for gives the result of running its tasks one after another, in order, stopping at the first failure; a task reads outer names and never assigns them.

15.8.2 Recap

  • together with two or more let branches runs them as tasks, and binds their names after the block, in order.
  • A branch sees the names bound before the block, never its siblings, and keeps its own clause.
  • together for x in xs runs one task per element and gives their values in list order.
  • together is a statement; together for is a value: after let, in an assignment, or last in a block.
  • A task never assigns an outer name (U2023): return a value, and combine the list after the block.
  • The first failure in order wins; later tasks are canceled, earlier ones run on.
  • Effects are recorded in task order, but printed lines may appear in any order: print after the block.

15.8.3 Reference

Next:16 Memory