Developer Drew DeVault has announced a new system programming language, Hare, which has been in development for nearly two and a half years and uses a statically typed system, manual memory management and a minimal runtime, making it ideal for writing operating systems, system tools, compilers and other low-level, high-performance tasks.
According to Drew DeVault, Hare is most similar to C, and almost any program written in C can also be written in Hare, but Hare is simpler than C.
Hare’s Hello World
Hare computes its own SHA-256 hash.
Hare is based on the qbe compiler backend, which provides good performance in a small footprint.
There are already many programs based on the Hare programming language, such as
- Himitsu: a key management and password storage tool. It stores keys as key/value pairs and allows storing additional information, such as username, host and protocol.
- Helios: Microkernel for x86_64 systems.
- box: A simple CLI encryption tool.
- btqd: bittorrent daemon.
- hare-libui: libui bindings for simple GUIs.
Hare’s OpenGL bindings are a work in progress and are currently available for several small games, such as Tetris.
Simple raytracer written using Hare.
The Hare Standard Library contains the following standard components, which provide support for many use cases without any dependencies
- Cryptography suite
- Network support
- Comprehensive date/time manipulation
- I/O and file system abstraction
- Unix primitives such as poll, fnmatch, and glob
- POSIX extended regular expressions
- Hare parser and type checker
This standard library frees Hare from the legacy of POSIX and libc, and Hare programs are not linked to libc by default.
The Future of Hare
Hare is currently under conservative development, and the biggest task of the standard library is to complete the cryptographic implementation, with the primary goal of supporting TLS (Transport Layer Security) 1.2 and TLS 1.3. Once it reaches version 1.0, Hare will complete the language specification, freeze the language design, and only make backward-compatible changes to the standard library.
In addition, Hare currently supports only three architectures: x86_64, aarch64, and riscv64, with support for 32-bit platforms and other architectures to be added over time. For operating systems, Hare currently only supports Linux and FreeBSD, with plans to do more ports in the future.
We do not intend to support non-free platforms, but since the language is standardized, third-party implementations or branches can easily develop Windows or macOS support if needed.
More information about the Hare program can be found on the roadmap.