Skip to main content

Hew 0.11 rc4: preserving grouped machine guards

· 2 min read
v0.11.0-rc4

Hew 0.11.0-rc4 fixes a formatter problem with grouped machine guards. It builds on the failure diagnostics, debugging tools and interpolation changes in rc3.

Keep the guard you wrote

Parentheses in a guard can change which events permit a transition. For example:

when (a || b >= state.n) && b > 1

The formatter now preserves that grouping instead of refusing to format the source. The formatted result can be formatted again without changing it. RC4 also keeps consecutive constants together and formats multiline else if chains consistently.

The machine guide now shows how to step a machine inside a mutable record and how a transition can carry compatible fields from one state to another with ..state.

Profile an optimized program

Build with -g to keep source information for a profiler. For example, after setting up the dataset in the MicroGPT example, run these commands from its directory with Samply installed:

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; a generic profiler needs debug information or matching separate symbols to show source locations.

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-rc4

This is a prerelease. The stable website and browser playground continue to use Hew 0.10. The RC4 release notes include the full changes and migration guidance.

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