Skip to main content

Try Hew 0.11: clearer actor failures and native debugging

· 3 min read
v0.11.0-rc3

Hew 0.11.0-rc3 is a release candidate for trying improved failure diagnostics and debugging before the next stable release. An actor’s failure can now carry a trace beyond the actor’s cleanup, and native programs can be launched under a debugger or inspected by attaching to a running process.

Inspect an actor failure

A trapped actor call now returns an owned CrashInfo in ActorError.Trapped. It includes the failure kind and message, plus an optional trap, source site and trace. A crash hook receives the same failure facts. You can inspect the trace with failure.backtrace(info); a missing trace is None.

This is a source change. Replace a .Trapped match arm with .Trapped(info), or .Trapped(_) if the details are not needed. For example, inside a match on a call result:

.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. Code that constructs a CrashInfo must also provide its new trap, site and trace fields. When a bounded actor cannot retain all the details, the trace is omitted first, then the site, and the message may be empty. Browser sandbox traces include available function frames; the current browser package does not include source file and line information.

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

Debug a native program

Run hew debug program.hew to launch a debugger and stop when a failure is raised, after its record is available. To inspect a running process, use hew debug --attach PID, subject to your operating system’s permissions. hew debug --print-config supplies a launch configuration for editor adapters, and hew symbolize resolves recorded addresses.

hew symbolize can use Hew’s retained tables to resolve locations in stripped binaries. For a generic debugger or profiler such as Samply, build with -g or supply matching separate debug symbols. Optimized locals and physical frames remain subject to compiler optimization. On Windows, the matching debug-symbol archive contains hew.pdb for inspecting the compiler itself; place it beside bin/hew.exe.

RC3 also corrects source locations for imported Hew files, including in optimized builds.

Formatting and compiler improvements

String interpolation appends primitive values and literal text with fewer temporary strings in native and browser execution, while keeping expression and Display call order. Strings can retain spare capacity, so a bounded actor may reach its heap limit at a different point.

The browser compiler also handles long, flat binary expressions and pattern alternatives without a recursive compiler call for every term. Existing nesting diagnostics still apply to deeply nested expressions.

Try the candidate

Install the candidate explicitly and rebuild native modules against its matching SDK:

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

This is a prerelease; the stable website and browser playground continue to use Hew 0.10. The release notes include the complete migration guidance and debug-symbol details. RC1 and RC2 have source tags but no binary releases. RC2 fixed macOS debug-symbol packaging; RC3 adds the imported-source debug information correction.

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