Skip to content

Catallaxy 0.4.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 22:46
· 52 commits to main since this release
d56de6a

Install

curl -fsSL https://raw.githubusercontent.com/CodingAnarchy/catallaxy/main/install.sh | sh   # Linux, macOS
cargo install catallaxy                                                                   # any platform with Rust

This is the first release with prebuilt catx binaries: Linux and macOS on x86_64 and arm64, plus Windows x86_64. Each archive has a .sha256 file, and SHA256SUMS lists them all. Milestone: 0.4.0 (44 issues).

Highlights

Language and standard library

  • Formatting: string format specs ("#{x:>8.2f}") and String.format.
  • Collections: O(1) ASCII string indexing and Deque[T].
  • JSON: integers of any size stay exact.
  • New APIs: lazy sequences (xs.lazy(), Lazy[T]); Duration, Instant and DateTime; Csv, Bytes, Digest, Env.set, Stdin.lines.
  • Language: import a.b as c, Enum.values(), and (obj.f)(x) for calling a function stored in a field.
  • Optionals: ??=, ok_or, and nil narrowing of fields.

Type checker

  • Soundness fixes: untyped-parameter functions, members of union types, narrowing across loops, branches and closures, and Self through bounds.
  • Comparable: sorting needs Comparable, and tuples and lists are Comparable.
  • New diagnostics: E0206, E0372, E0373, a StringBuilder lint (W0004) with a quick fix, and # allow(CODE) to silence warnings.
  • Error reference: every code is documented in docs/errors.md, and catx check links to it.

Memory and performance

  • Garbage collection:
    • Stale registers no longer keep garbage alive.
    • Empty heap segments go back to the OS.
    • Small lists store their elements inline.
    • Minor collections scan only the written part of large old containers.
  • Out of memory: raises MemoryError with a trace instead of aborting, for oversized requests, heap growth, strings, collections, stacks, threads and fibers. CATX_MAX_HEAP caps the heap.
  • Speed: string concatenation is about 3× faster.

Tooling

  • Editors: a VS Code extension, in editors/vscode (build it from source; it's not on the Marketplace yet).
  • Language server:
    • Quick fixes, and catx fix to apply them from the command line.
    • References, rename and workspace symbols cover the whole workspace, including classes that conform to an interface.
    • It warms its cache in the background, and the shared prelude makes that faster.
  • Formatting: catx fmt and catx check accept directories.
  • C API: uses Catallaxy's allocator by default, and cx_allocator_active() reports whether it's in use.

Breaking changes

  • Untyped-parameter functions: some calls that used to type-check and then fail at run time are now rejected. See reference §6.3.
  • Narrowing and unions: code that relied on the unsound narrowing or union rules above no longer checks. Each newly rejected program would have panicked at run time.
  • Time.millis(): counts milliseconds since the Unix epoch, not since program load.
  • join(): on a thread that panicked, it returns Err(message) without a trace. A panicked thread that is never joined is reported, with its trace, when the program exits.
  • JSON: Json.parse reads -0 as the Int 0.
  • catx allocator: the binary now installs its own global allocator. Rust programs embedding the catallaxy crate can opt in; the C API (catallaxy-capi) uses it by default through its global-allocator feature.

What's Changed

Full Changelog: v0.3.0...v0.4.0