Wado

WEP: Every Package Has a Coordinate

Context

[package].namespace was optional. A package without one had no coordinate, and the rules around packages grew a second case for it:

The namespace was optional so that a package nobody publishes did not have to pick one. publish = false already says that, so the optional namespace bought nothing, and cost a second case in each rule above.

With the second case gone, a coordinate key still trusted its source: nothing checked that "acme:geo" = { path = "../geo" } reaches acme:geo, and two directories declaring one coordinate compiled as two packages with two sets of types.

Decision

The namespace is required

[package].namespace is required. A manifest whose [package] has none is an error, as one without name or version is. A workspace member inherits the namespace of [workspace.package], as before.

Every package therefore has a coordinate, namespace:name, whether or not it is published. What follows from that:

A coordinate key names its package

A path or git source under a coordinate key must hold the package whose [package] declares that coordinate. A key whose source declares another one is unresolved, and a use of it reports both coordinates.

A single-file path source has no manifest, so it declares no coordinate. Only a lib: key names it.

One coordinate is one package

Two directories declaring one coordinate, with versions in one compatibility range, are one package claimed twice. The first one the build reaches holds the package, the entry's own package first. A use that reaches the second is an error naming both, at any depth in the dependency graph.

Versions in two compatibility ranges stay two packages, which is how two lib: aliases depend on two major versions of one coordinate (Packages).

This repository names its packages by coordinate

A lib: key that only shortened a sibling's coordinate ("lib:gale" for wado-lang:gale) becomes the coordinate itself, in every manifest and use. lib: stays where a test or a document is about the alias.

Roadmap

  1. [x] wado-manifest refuses a [package] with no namespace, and wado init requires --namespace unless the workspace sets one.
  2. [x] Every manifest in this repository declares a namespace or inherits one.
  3. [x] A coordinate key, in [dependencies] and [build-dependencies], and the package a path source publishes as, are checked against the [package] the source holds, and a single file under a coordinate key is refused.
  4. [x] A second directory claiming a package already held is refused at the use that reaches it.
  5. [x] This repository's manifests and uses name sibling packages by coordinate.