Skip to content

Rak v0.7.1

Choose a tag to compare

@github-actions github-actions released this 18 Sep 20:05
· 85 commits to main since this release

Rak v0.7.1

This release pulls the language together. Rak now type-checks before it runs, mutability actually means something, and a few long-missing primitives (char, base literals) are first-class. Same installer, IDE, vscode-rak extension, and docs as 0.7.0, refreshed to match.

What changed

Static type checking

rakc check <file> now runs a real type-checking pass, not just lex+parse. It infers literal types, checks let x: T = value annotations and function-call arguments, and reports expected-vs-found types with the source line (error[E0308]). Numeric literals are mutually compatible; char and string are not, so let x: char = "hi" is caught before anything runs.

Mutability is now enforced

let x = 10; x = 20 is an error (cannot assign to immutable variable 'x'). Use let mut x to rebind. Enforced on both the interpreter and the bytecode VM, so the two backends agree.

char type

A first-class Unicode scalar, distinct from u8 and bytes. let c: char = 'א', plus \u{...} and \xNN escapes. Works across the interpreter, VM, and type checker.

Base literals

0b1010, 0o755, and underscore separators (1_000_000). All integer forms compare equal by value, so 0xA == 10 is true on both backends.

Generic functions

fn identity<T>(v: T) -> T, callable as identity<int>(42) or inferred identity(42). Type arguments are validated and then ignored; the runtime stays dynamic.

Enum variant patterns

match e { Event::Connect(host) => ... } with tuple and unit variants, on newline- or comma-separated arms. The checker flags non-exhaustive matches and repeated variant patterns.

defer

defer cleanup() runs in LIFO order when the function exits, on a normal return or a raised error. New Op::DeferCall makes the bytecode VM behave identically to the interpreter.

Test framework

rakc test [file] [--filter NAME] [--verbose] runs test "name" { ... } blocks. assert, assert_eq/ne/true/false, expect_error(fn() {...}), and panic(msg) all work. A failing test exits non-zero.

Synced tooling

The vscode-rak TextMate grammar, the IDE tokenizer/autocomplete, and the docs-site syntax highlighter all recognize the new keywords (defer, test, assert), the char type, \u{...} escapes, and 0b/0o literals. Full docs updated to match.

Full changelog

rakc check        static type checker
char type         Unicode scalar with \u{...} / \xNN escapes
let mut           immutable bindings reject reassignment
0b / 0o           base literals + underscores; 0xA == 10
fn f<T>()         generic functions (explicit or inferred)
Event::Variant()  enum variant patterns; exhaustive-match warnings
defer expr()      LIFO cleanup in interpreter and VM (Op::DeferCall)
rakc test         test blocks + assert / assert_eq / expect_error / panic

Install

See README for curl | bash (Linux) and iwr | iex (Windows), or grab rak-setup from this release. The Tauri installers (NSIS/MSI/.deb/AppImage) are also attached.