MoonBit STL
Vol. I  ·  MMXXVI  ·  The MoonBit Standard Library wasm-gc · booting

MoonBit STL

An Atlas of Ten Families · Data Structures & Algorithms

Plate I  ·  The Argument

Structures held to
a second opinion.

Ten families of containers, queues, trees, caches, sketches and text algorithms for MoonBit, bound as one module. Each is accompanied by reference values computed twice, by two other standard libraries, and admitted only when those two agree.

Every specimen in the Workbench is the library itself, compiled to WebAssembly and instantiated in this tab — not an illustration of it.

10
Families
23
Specimens
—
Public types
4
Backends
PLATE II

The Workbench

23 specimens · 9 packages · wasm-gc · —
No.I

IndexMap

@map · insertion order + position lookups
Input
Recorded result —
loading the module…
MoonBit STL · wasm-gc
What this calls

        
PLATE III

The Ten Families

One module · one package per family
PLATE IV

The Assay

Differential · mutation · replay
2refs

Answers computed twice

Each family's reference values are produced independently by the Python standard library and by Rust's, then compared byte for byte. Nothing is committed until both agree.

18breaks

Mutation tested

Two key lines per family were broken deliberately — comparisons, bounds, renumbering, expiry — and each break turned the suite red before it was reverted.

4backends

The same tests everywhere

Wasm, wasm-gc, JavaScript and native run the identical suite, so no structure is allowed to drift on one target and pass on another.

260 tests per backend
9 families replay vectors
0 self-written expectations
108 types documented
PLATE V

The Reference

generated from pkg.generated.mbti  ·  after the manner of cppreference
PLATE VI

Instruction

One dependency · no transitive ones

      
I

Add the module

moon add moonbitstack/moonstl — the only dependency is MoonBit's own seed package.

II

Import a family

Packages are separate: bring in map, heap, tree, cache, sketch, seq, text, phf, algo or spec — and nothing else follows.

III

Run it anywhere

Wasm, wasm-gc, JavaScript and native. Capacities and orderings are explicit arguments, and fallible constructors raise rather than abort.