---
title: "16.9 Recap and reference"
url: https://una-lang.org/en/learn/memory/recap-and-reference/
release: v0.4.0
edition: "0.2"
---

# 16.9 Recap and reference

## 16.9.1 For agents

:::agents
`una --json check .` gives each diagnostic of this chapter with its code and exact place. For [Leaving out `edit` at the call](https://una-lang.org/en/learn/memory/common-mistakes/#leaving-out-edit-at-the-call-u2020):

```json include="mistakes/1/expected/commands/json.txt#L2"
{"schema":"una.diagnostics/1","diagnostics":[{"schema":"una.diagnostic/1","code":"U2020","severity":"error","domain":"types","message":"parameter `ledger` of `apply` is declared `edit`, so its argument is written `edit ledger`","primary":{"file":"src/stockcount.una","start":{"line":63,"col":22},"end":{"line":63,"col":28}},"related":[],"repairs":[{"rank":1,"escape_cost":0,"description":"write `edit ledger`","edit":{"file":"src/stockcount.una","start":{"line":63,"col":22},"end":{"line":63,"col":28},"replacement":"edit ledger"}}],"explain":"una explain U2020"}],"fixable":1}
```

The repair carries an `edit` that `una fix .` applies, so the document reports `"fixable":1`. U2012, U2017, U2019 and U3013 carry no edit: the right change depends on intent. `una --json run .` reports U6003 with `"status":"aborted"`, as in [section 16.4](https://una-lang.org/en/learn/memory/limits-call-depth-and-memory/#s16-4). The compact rule: *a call that changes a binding names it with `edit`, on a line of its own; a binding given with `take` is not used again until it is assigned; `old(x)` appears only in `ensures`, on an `edit` parameter.*
:::

## 16.9.2 Recap

:::recap
- A `let` binding is a value, and a copy is a value of its own.
- `let edit` makes a binding editable: assign it or its fields with `=`, and a list element with `edit xs.set(…)`.
- An `edit` parameter passes a value in and out. The call writes `edit`, and a failed call leaves the argument unchanged.
- `old(x)` is an `edit` parameter's value on entry, and only `ensures` may use it.
- After `take x`, `x` is not used again until it is assigned.
- A loop's turns are not calls: only calls in progress count toward the call depth.
- U6003 stops a run at the call depth or the memory budget. Build long lists with loops.
:::

## 16.9.3 Reference

:::reference
- Construct pages: [`let edit` and `edit` parameters](https://una-lang.org/en/docs/language/control-flow/let-edit/), [`take`](https://una-lang.org/en/docs/language/control-flow/take/), [`for`](https://una-lang.org/en/docs/language/control-flow/for/), [`ensures`](https://una-lang.org/en/docs/language/functions/ensures/), [`attempt`](https://una-lang.org/en/docs/language/errors/attempt/), [`capability` and `op`](https://una-lang.org/en/docs/language/capabilities/capability/), [`handler`](https://una-lang.org/en/docs/language/capabilities/handler/), [`example`](https://una-lang.org/en/docs/language/examples/example/)
- Prelude: [`set`, `append`, `Map` and `with`](https://una-lang.org/en/docs/std/)
- Diagnostics: [U2012](https://una-lang.org/en/docs/errors/U2012/), [U2017](https://una-lang.org/en/docs/errors/U2017/), [U2018](https://una-lang.org/en/docs/errors/U2018/), [U2019](https://una-lang.org/en/docs/errors/U2019/), [U2020](https://una-lang.org/en/docs/errors/U2020/), [U2021](https://una-lang.org/en/docs/errors/U2021/), [U3013](https://una-lang.org/en/docs/errors/U3013/), and at run time [U6003](https://una-lang.org/en/docs/errors/U6003/) (call depth or memory)
- Command line: [`una run`](https://una-lang.org/en/docs/cli/run/), [`una test`](https://una-lang.org/en/docs/cli/test/), [`una build`](https://una-lang.org/en/docs/cli/build/)
- Specification: [memory model](https://una-lang.org/en/docs/spec/17-memory-model/), [dynamic semantics, limits](https://una-lang.org/en/docs/spec/11-dynamic-semantics/), [native backend](https://una-lang.org/en/docs/spec/16-native-backend/)
:::
