Skip to content

Catallaxy 0.4.1

Latest

Choose a tag to compare

@github-actions github-actions released this 15 Oct 01:17
· 45 commits to main since this release
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