Home / Learn / 1 Hello, Una

Release v0.4.0Edition 0.2

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.lock and modules under src/; una check . checks it, and una run . also runs it.
  • The file src/morning.una holds the module morning, and its first line says module morning.
  • A run starts at pub main() -> Unit of the module that entry names, 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 grants console in una.toml.
  • Comments start with --; doc comments, ---, document the declaration under them.
  • An example calls a function and states its result: do greeting(), then expect result == "Good morning".

1.10.3 Reference

Next:2 Numbers