ADR-338: std Is the Core the Language Stands On; Formats and Protocols Are Official Packages, Versioned on Their Own and Taken in by Their First use

Status: Accepted Date: October 9, 2026 (#539) Answers: what belongs in std, and where a format or a protocol a program needs every day goes instead Related: ADR-286 D23-D26 (a published package x is the crate nikaia_x), D19 (a dependency is a crate of its own); ADR-336 D2 (every crate the project publishes takes the prefix); ADR-002 D4 (std is compiled once per machine); Part III 17

1. Question

Does std hold the formats and protocols a program uses every day (JSON, TOML, CSV, HTML, HTTP), or only what the language itself stands on?

Part III 17 calls std “batteries included” and already lists std::html, std::http1 and std::json; nobody decided that it should. What is in std moves with the language’s version: once the language is stable, a module there can no longer change incompatibly, and a mistake in its API stays.

2. How others do it

Language std What came of it Source
Python large some twenty modules removed as dead (PEP 594); urllib displaced in practice by requests, never in std from memory, not checked
Java large java.util.Date kept for compatibility; java.time years later from memory, not checked
Go net/http, encoding/json, csv works; encoding/json’s faults stood for years until a second version from memory, not checked
Rust minimal formats and protocols in crates; freedom, and the cost of choosing among them from memory, not checked
Deno @std/json, @std/csv, @std/toml maintained by the project, each versioned on its own from memory, not checked
Kotlin small, plus kotlinx official libraries, versioned on their own from memory, not checked

3. Facts that bear on it

4. Decision

D1 — std is the core the language stands on.

Input and output, files, text, collections, tasks and their channels, locks, processes, time, the command line, numbers, and what grammars and build-time code need from a library. A module is in std because the language cannot be used without it, not because many programs want it.

D2 — A format or a protocol is an official package.

JSON, TOML, CSV, HTML, HTTP/1.1’s text half and the database protocol are packages json, toml, csv, html, http1 and db: maintained in this repository, shipped with the toolchain so they work offline, each with a version of its own, and published as every package is, nikaia_json and the rest (ADR-286 D23, ADR-336 D2).

D3 — std lists the official packages, and a use of one takes it in.

std carries the list of official packages and the version of each that this toolchain ships. use json where neither [dependencies] nor a directory of the project (ADR-286 D37) names json takes in the official package at the listed version, recorded in nikaia.lock; a [dependencies] entry names another version. A name that is neither declared nor on the list is refused as before.

D4 — The toolchain’s own Nikaia uses them as any program does.

What the toolchain writes in Nikaia and needs a format for, reading nikaia.toml, depends on the official package; it is not a reason for the format to be in std.

D5 — A format package reads and writes.

json, toml and csv each read a text into values and write values into a text. Writing makes a new text from a value; editing an existing text while keeping its comments and order is not part of this.

Why. A format or a protocol is where APIs are most often got wrong and most often outgrown; versioned on its own, a second version is a release and not a compatibility break of the language. Taken in by its first use, an official package costs a program nothing to reach, so it loses nothing against being in std.

5. Consequences

6. What this does not decide

This site is open source. Improve this page.