Names & imports

Partly built

Dotted definition names, duplicate-name checks, and per-file import.

A definition’s name may contain dots (acme.billing.tax). The dots are part of the label, not of the hash; the editor and the CLI group by them. Defining a name that already exists is a conflict by default (--allow-duplicate-names opts out), and defining a name that hides an imported bare name produces a warning.

An import makes some stored names usable by their short form in one file. It is never stored and never hashed: the stored text always has the full names.

import acme/billing/{invoiceTotal, tax}

let checkout = (n: int): int => tax(invoiceTotal(n))
Verified, after adding acme.billing.invoiceTotal and acme.billing.tax in an earlier file: checkout(4) is 10.

import acme.billing brings in the namespace’s bare members, import lib/std/List followed by List.map(...) reads a member through the last segment, and two imports offering the same bare name are an error at the use, naming both full paths. A local definition or a local variable wins over an import.

Open: a directory tree derived from names, and imports across the bring-your-own-bucket path.