Home / Learn / 1 Hello, Una
1.10 Recap and reference
Page 11 of 11
1.10.1 For agents
una --json check . prints each diagnostic with its code, message, primary span and repairs; una --json test . prints each example's outcome. U0003, U1001 (when it can name the operation meant), U1008 and U2004 carry exact edits, which una fix . applies. U3003's repair adds a uses line, which gives the function more authority, so una fix never applies it: add it by hand. U0001, U0101, U2001 and U3004 depend on intent, so their repairs, when they have one, are descriptions only. The compact rule: a package is una.toml, verification.lock and src/<module>.una with a matching module line; the entry module has pub main() -> Unit; a function that prints declares uses @console: Console[print], and the run grants console.
1.10.2 Recap
- A package is
una.toml,verification.lockand modules undersrc/;una check .checks it, anduna run .also runs it. - The file
src/morning.unaholds the modulemorning, and its first line saysmodule morning. - A run starts at
pub main() -> Unitof the module thatentrynames, and runs its steps in order. - A function is a header,
=, and a body: one line in the short form, several steps in the long form. - Every argument after the first carries its label, or is a name equal to its parameter's:
section("Hours", notice: opening_hours()). - A public function that prints says so,
uses @console: Console[print], and so does every public function that calls it; the run grantsconsoleinuna.toml. - Comments start with
--; doc comments,---, document the declaration under them. - An example calls a function and states its result:
do greeting(), thenexpect result == "Good morning".
1.10.3 Reference
- Start: install, get started
- Construct pages: source files, comments and literals, functions,
uses, host capabilities and grants,example - Configuration:
[package] edition,[run] entry,[run] grants,verification.lock - Commands:
una check,una run,una test,una fmt,una fix,una explain - Standard library: the host capabilities (
Console,print) - Diagnostics: U0001, U0003, U0101, U1001, U1002, U1008, U2001, U2004, U3003, U3004, U7002, U7004
- Specification: lexical structure, functions and contracts, capabilities and effects, requirements and examples, diagnostics and the command line
Next:2 Numbers