Hew
A compiled language for programming with actors
Hew compiles actor-based programs to native code. Each actor owns its state, and supervisors decide how failed actors restart.
State stays with the actor
This session actor owns its message vector. post is the only code here that mutates the vector, and each call waits for the handler to finish before returning a Result.
After two posts, count returns the number of messages. The caller prints that number on success, or session unavailable if the call fails.
// A chat session is an actor: state lives in fields and only its handlers
// can mutate it. Ordinary actor calls wait for the handler and return a
// Result, whether or not the handler itself returns a value.
actor Session {
let user: string;
var messages: Vec<string> = Vec.new();
receive fn post(text: string) {
messages.push(text);
}
receive fn count() -> i64 {
messages.len()
}
}
fn main() {
let chat = spawn Session { user: "ada", messages: [] };
chat.post("hello").expect("actor stopped");
chat.post("world").expect("actor stopped");
let total = chat.count();
match total {
.Ok(n) => println(f"{n} messages posted"),
.Err(_) => println("session unavailable"),
}
}Install Hew
Choose your operating system to see the install command.
v0.11.2 Β· Release
$ curl -fsSL https://hew.sh/install | bash -s -- --version 0.11.2$ curl -fsSL https://hew.sh/install | bash -s -- --version 0.11.2> Invoke-WebRequest https://hew.sh/install.ps1 -OutFile install.ps1
.\install.ps1 -Version 0.11.2What the language makes explicit
Each of these is available in v0.11.2.
- Caller:
chat.post("hello"). Waits for the handlerβs result. - Mailbox:
post("hello"). - One handler turn:
messages.push(text). Private state:messages: ["hello"]. - Completion result β Caller.
A successful post updates Sessionβs private state before returning its result.
Actor Isolation
Only an actor can modify its own fields. The compiler checks which values callers can send to it.
Supervision Trees
A supervisor declares which children to restart after a failure and how many restarts to allow in a given interval.
Structured Concurrency
Use fork to start independent actor calls. Their enclosing scope waits for the child work before it returns.
Wire Contracts
Numeric tags identify fields in a wire type. The compatibility checker compares revisions of the schema.
Engineering Journal
Hew 0.11.2: module-private record fields and faster release builds Keep named record fields private to their declaring module, evict least-recently-used cache entries, and compile large Linux release builds in parallel. Nov 23, 2026Read the Blog β
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