Whim is an experimental programming language built for exploration.
Warning
Whim is a toy. Do not use it in production. Every release may add, remove, or redesign any part of the language. Whim has no compatibility promise, release schedule, or production support.
Whim checks types and keeps generic type arguments at run time. It has value-based collections, pattern matching, classes, interfaces, enums, and cooperative tasks.
final readonly class Box<T> {
public function __construct(public T $value) {}
}
function describe(mixed $value): string {
return match ($value) {
$box @ Box<int> => 'integer: ' . $box->value,
$box @ Box<string> => 'text: ' . $box->value,
$_ => 'other',
};
}
write_line!(describe(new Box::<int>(42)));
The whim executable runs source, formats code, prints bytecode, provides a
language server, and manages Git dependencies. The standard library is written
mainly in Whim. It covers async I/O, files, processes, networking, TLS, HTTP,
WebSockets, SQLite, PostgreSQL, dates, encodings, and common data formats.
We also maintain Trifle packages on Codeberg.
Install the latest release on macOS or Linux:
curl --proto '=https' --tlsv1.2 -sSf https://whim.sh/install.sh | bashYou can also download an archive from GitHub Releases. After installation, run:
whim --versionThe container image is available at ghcr.io/carthage-software/whim.
Whim supports macOS on x86-64 and Arm64, Linux with glibc on x86-64, Arm64, and RISC-V 64, and Linux with musl on x86-64 and Arm64.
To build Whim from source, install Rust 1.98 or later and run:
cargo build --locked --release
./target/release/whim --versionTry Whim in the Whim playground without installing it. The Whim book documents the language, command-line tools, package manager, and standard library. Start with Installation, then write Your First Program.
Run the Rust and Whim test suites with:
cargo test --locked --workspace --all-features
cargo build --locked --release --bin whim
./target/release/whim tests/run.whimThe Justfile provides shorter development commands.
Whim accepts issue reports but not pull requests. Read CONTRIBUTING.md before opening an issue. Follow SECURITY.md to report a security problem.
Use Whim under either the Apache License, Version 2.0 or the MIT License.