Home / Docs / Configure a package

[package] edition

Release v0.4.0Edition 0.1 and laterU0103U7002

What it does

A package is one program or library: a directory with its source files under src/ and its manifest. edition says which version of the Una language the package is written in. In una.toml it is "0.1", "0.2", or the preview "0.3". From edition 0.4, the manifest is ita.una, and its edition line names 0.4 or 0.5, both previews (ADR 0121, ADR 0139). An edition fixes the language a package sees, so a package keeps compiling the same way when a newer una comes out; a preview may still change, by the terms below. Edition 0.2 adds constructs and keywords to 0.1, and some rules differ between them. The later editions are cumulative: each has every construct, keyword and rule of the edition before it, with the exceptions listed below, and adds its own.

Learn more: An edition is part of the package and Edition 0.3, a preview.

una.tomltoml
[package]
name = "shop"
version = "0.1.0"
edition = "0.2"
src/shop.unauna
module shop

pub price(cents: Int) -> Int = cents

Forms

toml
[package]
edition = "0.1" | "0.2" | "0.3"

From edition 0.4, a package is described by ita.una instead (spec/30):

text
ita <name>
  version <version>
  edition 0.4 | 0.5

Examples

An edition the compiler does not know is rejected:

una.tomltoml
[package]
name = "shop"
version = "0.1.0"
edition = "0.6"
src/shop.unauna
-- fails with U7002
module shop

pub price(cents: Int) -> Int = cents

Edge cases

Edition 0.2 constructs need edition 0.2 or later. In a package of edition 0.1, their keywords are reserved:

una.tomltoml
[package]
name = "shop"
version = "0.1.0"
edition = "0.1"
src/shop.unauna
-- fails with U0103
module shop

pub next_order(last: Int) -> Int
=
  let edit order = last
  order = order + 1
  order

Further rules:

Diagnostics

Edition

The stable editions are 0.1 and 0.2; 0.3, 0.4 and 0.5 are previews. una --version lists the editions a release serves, and on its preview: line the ones that are previews.

Normative source