Skip to main content

Hew 0.11: trace an actor failure and debug a program

· 3 min read
v0.11.0

An actor can fail and be restarted while the rest of a service continues. Hew 0.11 makes the details of that failure available after cleanup, so the caller and crash hook can inspect what happened. This release also adds native debugger commands, improves editor completions and makes string interpolation allocate fewer temporary values.

Inspect a trapped actor call

ActorError.Trapped now carries an owned CrashInfo: the failure kind and message, optional trap and source site, and an optional trace of function frames. A crash hook receives the same failure facts. For example, inside a match on an actor call:

.Err(.Trapped(info)) => {
    println(info.message);
    match failure.backtrace(info) {
        .Some(frames) => println(frames.len()),
        .None => println("no trace"),
    }
}

Import std.failure as failure to use backtrace. Update an existing .Trapped match arm to .Trapped(info), or .Trapped(_) when the details are not needed. Code constructing a CrashInfo also needs to supply trap, site and trace. A bounded actor can omit the trace and site, and may leave the message empty, when it cannot retain the details within its budget. Browser sandbox traces include available function frames; their current package format does not include source file and line information.

Distributed failure replies now use protocol version 13. Hew 0.10 peers use version 12 and reject the newer protocol, so upgrade communicating nodes together.

Debug and profile native code

Run hew debug program.hew to launch a debugger that stops when a failure is raised, after the failure record is available. Use hew debug --attach PID to attach to a running process, subject to operating-system permissions. hew symbolize resolves recorded addresses and can use retained Hew tables in stripped binaries.

For a generic debugger or profiler such as Samply, build with -g or supply matching separate debug symbols. For example, after setting up the dataset in the MicroGPT example, run these commands from its directory:

hew build -g --opt-level 2 microgpt.hew
samply record ./microgpt

Make a new recording after rebuilding. The default build is unoptimized and strips symbols; optimized locals and physical frames are still subject to compiler optimization.

Editing and formatting

Completions use Hew source spelling and the appropriate context for free functions, constructors and methods. The formatter preserves parentheses in grouped machine guards, keeps consecutive constants together and formats multiline else if chains consistently. The browser compiler also handles long, flat binary expressions and pattern alternatives without adding a recursive compiler call for every term; deeply nested expressions still receive the nesting diagnostic.

Upgrade

Install the matching compiler, runtime and headers, and rebuild native modules:

curl -fsSL https://hew.sh/install | bash -s -- --version 0.11.0

Hew 0.11 continues edition 2026. The release notes cover the complete changes, migration and debug-symbol details.

Hew Notes

Language development, engineering articles, releases and community projects, about once a month, with an extra issue for a significant release. Written in English.

Subscribe to Hew Notes