Skip to content

v0.3.1

Choose a tag to compare

@github-actions github-actions released this 07 Jun 08:58
· 350 commits to main since this release

Language

Predicate subtypes
Named types may include a predicate function evaluated at construction time:

type Port int predicate func(x) { return x >= 1 && x <= 65535 }
p := Port(80)   // ok
p2 := Port(0)   // PredicateViolation

The predicate compiles as a closure and may capture variables from the enclosing scope.

Variant records with shared fields
Variants may declare bare fields in their body alongside arm declarations. Shared fields are present on every value and accessible without a match:

type Shape variant {
    x float,
    y float,
    circle { radius float },
    rect   { width float, height float },
    point
}
s := Shape.circle { x: 1.0, y: 2.0, radius: 5.0 }
std.io.println(s.x)  // no match needed

Multi-field variant arms
Variant arms may carry a struct-like payload bound in pattern matching:

switch s {
    case .circle(f) { std.io.println(f.radius) }
    case .rect(f)   { std.io.println(f.width, f.height) }
}

Embedding

Host-defined module registration
Hosts can register named modules callable from scripts:

engine_register_module(handle, "@module:mylib", funcs, func_count);

Scripts import with import("@module:mylib").

Host ABI v2
Five new host dispatch IDs for std.conv.* and std.core.bytelen. ABI version bumped to 2; capability bits guard the new calls with fallback to embedded implementations.

Native shared library
New build targets produce libgengo-engine.so / .dylib / .dll with the same C API as gengo-engine.wasm:

zig build -Dpreset=dev engine-native

ValueWire arrays and maps
engine_call results may now return arrays and maps across the boundary as ValueWire tag 4 (array) and 5 (map).

TypeScript SDK
sdk/typescript/ wraps gengo-engine.wasm with typed GVal encoding and a GengoEngine class.

Runtime

fix: predicate closure GC
Predicate closures on named types were being collected during long loops. The named_type GC mark path now traces the predicate field.

fix: Windows CLI cross-compile
Two type mismatches in the CreateFileA extern declaration caused the Windows release build to fail in v0.3.0. Fixed by declaring the path buffer as a sentinel-terminated array and hTemplateFile as optional.

REPL

  • Auto-print top-level expression results in interactive sessions
  • Typed redeclaration detection for globals
  • Error display includes source snippet and caret

Platform

  • Windows native CLI (x86_64-windows, no-libc)
  • std.time.sleep removed

Conformance

146 pass-cases · 133 fail-cases