Skip to content

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 14 Oct 12:39
· 1020 commits to main since this release
v0.6.0
c4b08fc

Hew v0.6.0

Hew 0.6 lets you start independent work with fork, collect its results with
await, and carry resources and typed failures through those calls. Native
I/O suspends while waiting, and cleanup runs when work completes or is
cancelled. This release also expands value semantics, source-level testing
and native/sandbox data codecs.

Upgrading from 0.5 or a 0.6 prerelease

Source syntax and standard-library APIs changed during the 0.6 release cycle.
Review the migration guide for the changes affecting
your installed version, then:

  1. Resolve package dependencies and run hew fmt --migrate --root . from the
    project root. Review its output before checking and rebuilding the project.
    Checker-backed migration now processes one semantic unit at a time to limit
    memory use when import graphs overlap.

  2. Replace the former blocking race { ... } form with await race [...], or
    store the task returned by race [...] and await it later.

  3. Use braces for keyed construction and parenthesize a propagated Result
    before accessing its fields or methods:

    Previous spelling Current spelling
    spawn Worker(id: 1) spawn Worker { id: 1 }
    load()?.field (load()?).field

    Records use type, enum variants use dotted forms, and bodyless declaration
    members end with semicolons. The migration guide lists retired APIs and
    their replacements.

  4. Keep the compiler, runtime and standard library on the same SDK version.
    Rebuild native libraries and C integrations against that toolchain.

Concurrent work and failures

Ordinary calls wait for a result. fork starts independent work, and await
joins its task. await fork [left(), right()] collects results in input order;
a tuple batch supports results with different types. When the results are
Result values, handle each one separately.

race [...] accepts calls or existing task handles and produces a task. It
cancels and drains losing work, including cleanup, before making the winning
result available. select waits for readiness; unselected task handles keep
running.

Functions declaring fails E can propagate typed failures with ?. defer err
runs on failure propagation, faults and cancellation, in the same cleanup order
as ordinary defers. A returned Result.Err or Option.None is an ordinary
value and does not trigger failure-only cleanup.

Tasks keep their lifetimes when passed through patterns, aggregates, callbacks
and generic calls. Actor calls, generators and I/O participate in structured
cleanup. Supervision keeps child roles stable across restarts, and actor teardown
allows cleanup hooks to finish before releasing the actor.

Native I/O and shutdown

Idle scheduling waits for events and actual deadlines. Socket, pipe and TLS
operations suspend without occupying a scheduler worker. Process capture drains
stdout and stderr concurrently and handles cancellation, termination and reaping.

  • Shutting down a listener could leave the program waiting indefinitely if an
    accept waiter registered just after shutdown woke existing waiters. Waiter
    registration now observes closed admission, allowing shutdown to finish.
  • On macOS, an unrelated child process could keep another child's output pipe
    open and delay EOF. Process creation now keeps each child's pipes isolated.
  • On Windows, cancelled TLS reads and writes leave the connection usable through
    nonblocking I/O and readiness waits.
  • A nonblocking sink retains the unwritten remainder of an accepted item and
    flushes it before another item. Full means no bytes were accepted, so retrying
    the item does not duplicate its beginning.

Distributed sends use claims tied to the authenticated peer and route.
Authentication and JWT validation reject invalid trust inputs.

Values and data

Records, enums, arrays, collections, closures, resources and trait objects
compose through the same ownership rules. Nested collection updates preserve
value snapshots. Generic associated results, aggregate ordering and mutable
trait-object receivers preserve their checked types and state in native code.
Double-ended iterators support reverse traversal without collecting first.
Actors with zero-sized arguments, replies or state use their checked layouts
without accessing storage for empty values.

Typed locals may defer initialization when every path assigns them before use.
Optional chaining preserves ownership and borrowing through resource access.
Package membership and package-root imports follow the nearest hew.toml;
ambiguous sibling and root imports are diagnosed.

Strings preserve UTF-8 and embedded NUL contents. Byte decoding offers explicit
fallible and lossy forms. JSON, CBOR, YAML, TOML and MessagePack share typed codec
shapes across native execution and the sandbox VM, including exact integer
ranges and typed decode errors.

Testing and development tools

Source tests support exact selectors, structured failures and seeded reruns.
Property tests generate typed values and shrink failing examples; benchmark
suites support calibrated measurements and saved-result comparisons. Native
and sandbox coverage use the same source identities.

The LSP follows checked bindings for renames, associated types and actor replies.
Editor grammars recognize the current task and construction syntax. Debug
metadata tracks local initialization and lifetime across suspension, marking
unavailable values instead of exposing stale frame contents.

The registry client supports official slash wire identities and custom registry
identity modes while retaining signature checks.

Platforms and further reading

The SDK ships for Linux x86_64 and ARM64, macOS Intel and Apple silicon,
Windows x86_64, and FreeBSD x86_64. Prebuilt FreeBSD tools require FreeBSD 15.1
or newer; FreeBSD ARM64 receives build and link checks without an SDK archive.

Consult the capability matrix when targeting the
sandbox, the language guide for the current APIs,
and the full changelog for release history.