Release v0.4.0Edition 0.2
16.9 Recap and reference
Page 10 of 10
16.9.1 For agents
una --json check . gives each diagnostic of this chapter with its code and exact place. For Leaving out edit at the call:
json
{"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. 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
- A
letbinding is a value, and a copy is a value of its own. let editmakes a binding editable: assign it or its fields with=, and a list element withedit xs.set(…).- An
editparameter passes a value in and out. The call writesedit, and a failed call leaves the argument unchanged. old(x)is aneditparameter's value on entry, and onlyensuresmay use it.- After
take x,xis 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
- Construct pages:
let editandeditparameters,take,for,ensures,attempt,capabilityandop,handler,example - Prelude:
set,append,Mapandwith - Diagnostics: U2012, U2017, U2018, U2019, U2020, U2021, U3013, and at run time U6003 (call depth or memory)
- Command line:
una run,una test,una build - Specification: memory model, dynamic semantics, limits, native backend
Next:17 Information flow