Repository navigation
v0.32.0
It’s been a while — the last release was on March 4th. This one is big: it brings the giant language feature, tagged unions, along with a wave of improvements across the standard library and compiler internals. The project was “frozen” for a bit, but it’s back; thanks for sticking around and experimenting with Neva. This update lays important groundwork for future safety and ergonomics improvements.
🧠 Language Changes
Tagged Unions
Neva now supports tagged unions (discriminated unions, variant types). They let you define values that can take one of several forms — similar to Rust enums or algebraic sum types.
- why it matters:
- Enables pattern matching directly on variant types
- Replaces C-style enums
- Opens the door for Rust-like exhaustive pattern matching in the future
Some early checks for invalid use are already implemented, but full exhaustiveness checking isn’t there yet. See issues: #747, #751, #756.
Enums → Tagged Unions
Use union instead of enum. Tags can be tag-only or tag + single payload type.
// before (c-like enum)
type Day enum { Monday, Tuesday, Wednesday }
// after (tag-only union)
type Day union {
Monday
Tuesday
Wednesday
}
// tag + payload
type Input union {
Int int
Str string
None
}
Under the hood, unions are structs with a tag: string field. For example, printing a tag-only value like Day::Monday shows { "tag": "Monday" }. This representation is useful to understand pattern matching.
Union sender syntax
// tag-only sender
Day::Monday -> println
// wrapped sender (tag + data)
Input::Int(42) -> println
You can wrap any sender, e.g. Input::Int(foo:bar) -> .... It will wait to receive from foo:bar, wrap the value with the Int tag, and send it onward.
Pattern matching (early support)
You can branch on union variants. Current matching supports routing; more exhaustive checks will come later.
src -> switch {
Input::Int -> handleInt, // message is int
Input::Str -> handleStr, // message is string
_ -> handleNone // message is something else
}
Operator Overloading Rewrite
Generic “unionish” operators were replaced with real overloads per concrete type to enable tagged unions. See #832 for details.
// BEFORE (generic)
#extern(int int_add, float float_add, string string_add)
pub def Add<T int | float | string>(left T, right T) (res T)
// AFTER (overloaded)
#extern(int_add)
pub def Add(left int, right int) (res int)
#extern(float_add)
pub def Add(left float, right float) (res float)
#extern(string_add)
pub def Add(left string, right string) (res string)
📦 Standard Library
Streams
- Internal improvements to avoid deadlocks and inconsistent termination.
- Fixed the
stream_productexample (it now runs as expected).
Lists
- Small safety and edge-case fixes (e.g., empty list handling).
IO / Fmt / Time
fmt.Printand friends can now display more internal types (e.g., union values) without crashing.- Time and IO modules got minor refactors for consistency.
Sync
- Internal refactor to prepare for better concurrency primitives.
⚙️ Compiler & Tooling
- Added support for union types throughout the type system and IR.
- A little better internal structure here and there.
- Diagnostics improved: error messages are a bit more specific and readable.
- Many tests updated or rewritten to cover new syntax and union semantics.
- No performance optimizations this time — focus was on correctness.
🧩 Misc Fixes & Refactors
- Dozens of small bug fixes in runtime and compiler.
- Better internal consistency.
- Examples and docs updated to reflect latest changes.
⚠️ Breaking Changes
- Tagged union syntax replaces
enumand introduces new constructs; check your code for naming collisions.
🙌 Thanks
Massive effort went into this one — mostly around tagged unions and cleaning up old compiler internals. Thanks to everyone experimenting with Neva, filing issues, and trying to make sense of the chaos.
-
new contributors:
-
read more: Release notes v0.32.0
-
full changelog:
https://github.com/nevalang/neva/compare/v0.31.1...v0.32.0