Skip to content

Releases: CodingAnarchy/catallaxy

Catallaxy 0.4.1

Choose a tag to compare

@github-actions github-actions released this 15 Oct 01:17
1ee12ec

A safety release. Ordinary Catallaxy code could crash catx with a segfault, kill it through deep recursion in native code, or hang it after an internal error. 0.4.1 fixes all three: the type checker rejects the programs that got wrong-typed values into native code, the runtime raises a catchable error wherever a check is still needed, and internal failures end only the thread they happen on. Upgrading is recommended. Milestone: 0.4.1.

Install

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

Fixes

No more crashes from wrong-typed values (#147)

  • Built-in methods and the interpreter's field, list, tuple and call instructions check the kind of object they're given, and raise TypeError: expected X, got Y with a trace instead of segfaulting or reading garbage. This covers values that arrive through Dyn, which the checker can't see.

The checker closes the holes that let wrong-typed values through

  • Overrides must have compatible signatures (E0227, #148): they accept the overridden method's parameter types, return a compatible type, keep its defaults, and don't move a parameter name to another position.
  • Type tests (is, as?, match) can't narrow by generic type arguments that are erased at run time (E0374, #149). Test the erased form (is Box) instead.
  • Interfaces with Self parameters, such as Comparable or a user Merge, can be used only as generic bounds, not as value types (E0375, #150). Write fn bigger[T: Comparable](a: T, b: T).

Deep recursion raises SystemStackError (#154)

  • Deep ==, hashing, <=>, JSON, and recursion through Mutex.lock, Atomic.update or par_map now raise a catchable SystemStackError on the main thread, threads, fibers and pool workers, instead of killing the process.

Internal errors no longer hang the program (#155)

  • An internal Rust panic ends only its thread, fiber or pool job. join returns Err("internal error: …"), the collector keeps working, and on the main thread the program prints the error and exits 101.
  • Nesting with lock on one object more than 1,000 deep is a LockError.

Upgrade notes

  • Newly rejected programs: the checker now rejects some programs that 0.4.0 accepted: incompatible overrides, type tests on erased generic arguments, and interfaces with Self parameters used as value types. Each such program could crash or misbehave at run time. The error messages include a suggested fix, and docs/errors.md has an example for each new code.
  • Performance: benchmarks are within noise. Loops that do nothing but read fields or destructure tuples are about 3% slower, from the new kind checks.

What's Changed

Full Changelog: v0.4.0...v0.4.1

Catallaxy 0.4.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 22:46
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

Read more

Catallaxy 0.3.0

Choose a tag to compare

@CodingAnarchy CodingAnarchy released this 13 Oct 15:41
b724a86

What's Changed

Full Changelog: v0.2.0...v0.3.0