torresjrjr(7) 0x85A5ADE2

Welcoming the Hare programming language

· Byron Torres

Harriet, the Hare mascot

Hare is finally being released to the public as beta. Forwarding the announcement post:

Hare is a systems programming language designed to be simple, stable, and robust. Hare uses a static type system, manual memory management, and a minimal runtime. It is well-suited to writing operating systems, system tools, compilers, networking software, and other low-level, high performance tasks.

Here’s a demo:

use datetime;
use time;
use time::chrono;
use fmt;

export fn main() void = {
	let dt = datetime::new(
		&chrono::tz("US/Mountain")!, -7 * time::HOUR,
		2019, 12, 27,   14, 07, 08,
	)!;

	fmt::println(
		datetime::asformat(
			// "%Y-%m-%d %H:%M:%S.%N %z %Z %L"
			datetime::STAMP_NOZL,
			&dt,
		)!,
	)!;
};

That’s the date of Hare’s first commit!

$ hare run main.ha
2019-12-27 14:07:08.000000000 -0700 MST US/Mountain

Hare is a wonderful language that has been in open-secret development for ~3 years. At the helm is Drew DeVault, the primary architect, along with a number of contributors from all around the FLOSS community. I’ve had the privilege of being a core contributor myself1 during this time. My most major contributions are the time::chrono and datetime standard library modules, which is demonstrated above, and which I’ve written about at length.

Chronology in Hare
https://harelang.org/blog/2022-04-17-chronology-in-hare/

I also introduced a feature into the fmt “formatting” module, called “parametric format modifiers”, for programmatically formatting all sorts of values as text.

fmt::printf("{0%1}", "Hare", &fmt::modifiers{ width = 6, ... })!;
// produces "  Hare"

I’d like to tell the stories of how those modules & features came to be, and to expand upon them. That’ll be for another set of blog posts. As for now, I can say that Hare has been a pleasure to work with.

I like to describe Hare as a simple, conservative, modern update to C, with a FOSS ethos. It doesn’t try to break computer science ground, or promise to solve a million dollar problem. It’s charm is in its simplicity, one of the language’s core principles. It’s “C-2019 from outer-space”2. It provides an approachable type system which includes key innovations like tagged unions and the match statement; a welding mask for errors, nulls, slices, and arrays; and genuine UTF-8 strings and runes handling. This blog post from the Hare blog explains best.

Hare’s advances compared to C
https://harelang.org/blog/2021-02-09-hare-advances-on-c/

The core team is dedicated to stability and pragmatism. The toolchain, compile-time, and ecosystem are small compared to the tangled behemoths of other system langs. Hare has an actual standalone specification, and is planned to reach v1.0 and then freeze. And upstream Hare will not support non-libre operating systems. That’s a lot of conviction, but Hare isn’t trying to take over the world. It will coexist with the diversity of languages out there, and thrive in its own niche. In short, the Hare project develops for a libre future and for the deliberate programmer, not the corporate, the ephemeral and the reckless.

Hare is also fun. Checkout this community-maintained list of Hare projects, some of which are mine (~torresjrjr), some of which are WIP:

Hare Project Library
https://git.sr.ht/~vladh/hare-project-library

I eventually want to make a hare-chess library, rewrite the ed(1) and vi(1) utilities, and Junegunn’s fzf. If you’re interested in contributing, comment below.

Try Hare today3 and tell us what you think. I’d love to talk about your experiences with Hare.

Announcing the Hare programming language
https://harelang.org/blog/2022-04-25-announcing-hare/


  1. I use the term “core” lightly, since so much had been done before I came.↩︎

  2. Hare does in fact take much inspiration from the lineage of Go, C, and the Plan 9 folks.↩︎

  3. There’s a hidden “old tutorial” available at https://harelang.org/tutorials/old-introduction/. I personally prefer it, and maybe you might too.↩︎