Skip to content

v0.5.1

Choose a tag to compare

@anonx3247 anonx3247 released this 27 Nov 05:27
f951fd6

Install: curl -fsSL https://strata-lang.dev/install.sh | sh (macOS arm64).

A new stored format. Every .strata file is re-encoded. A strata older than 0.5.1 can't read these files, and 0.5.1 doesn't read older ones: view old code as text with the strata that wrote it (strata view --proofs), then store it with this one (strata edit).

The stored format

  • Stable ids (#559): every definition and variant has a 32-bit id, kept across edits, renames and moves; references in the stored tree are ids, indexes into each file's id table. strata diff and strata merge-file pair definitions by id, so a rename on one side is followed by the other side's new uses. Files are about 7% smaller.
  • The stored tree is the core language (#562): handlers (x!, x?, except, or, !!, ??), ranges, indexing, slices, element assignments, comprehensions, Dict/Set literals and loop are stored as the core forms they stand for and shown back as written. Field defaults and T { ..r, f: x } are stored as written and lowered when read, so a field a record gains is filled in. A spread is stored written out.
  • Operators are trait methods (#558): a + b is stored as Add.add(a, b). A type gets an operator by implementing Add, Sub, Mul, Div, Rem, Neg, Eq or Ord (core.ops), also across two types (impl Mul[Int, Money] for Money). The compiled code for built-in types is unchanged.

Fixed on the way

  • std.agent didn't round-trip: each store added a std.agent. to a mixed union's member types.
  • merge-file merges a definition node by node again when its sides were stored apart.
  • tools/roundtrip.sh (parse(print(t)) == t) holds on all 146 files of the repository.
  • Sugar calls the built-ins by names no program can take ($core:at for xs[i], with #617's hygienic desugaring): a local or a function may be named at, range, map ….

Known issues

  • Diagnostics print a checked expression's built-in calls as calls (range(0, 3), slice(xs, 0, i)), not as the sugar written.
  • An assertion's message shows a record update lowered (Point { y: 3, x: p.x }).