Repository navigation
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 RustFixes
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 Ywith a trace instead of segfaulting or reading garbage. This covers values that arrive throughDyn, 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
Selfparameters, such asComparableor a userMerge, can be used only as generic bounds, not as value types (E0375, #150). Writefn bigger[T: Comparable](a: T, b: T).
Deep recursion raises SystemStackError (#154)
- Deep
==, hashing,<=>, JSON, and recursion throughMutex.lock,Atomic.updateorpar_mapnow raise a catchableSystemStackErroron 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.
joinreturnsErr("internal error: …"), the collector keeps working, and on the main thread the program prints the error and exits 101. - Nesting
with lockon one object more than 1,000 deep is aLockError.
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
Selfparameters used as value types. Each such program could crash or misbehave at run time. The error messages include a suggested fix, anddocs/errors.mdhas 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
- Checker: overrides must have compatible signatures (E0227) by @CodingAnarchy in #151
- Checker: type tests must not narrow by erased type arguments (E0374) by @CodingAnarchy in #152
- Checker: interfaces with Self parameters are bounds, not value types (E0375) by @CodingAnarchy in #153
- Natives and instructions check object kinds: TypeError instead of a crash (#147) by @CodingAnarchy in #195
- Runtime: internal panics end only their thread; deep with lock is a LockError by @CodingAnarchy in #197
- Runtime: deep native recursion raises SystemStackError instead of crashing (#154) by @CodingAnarchy in #199
- Release 0.4.1 by @CodingAnarchy in #201
Full Changelog: v0.4.0...v0.4.1