Since the public release of Hare there have been a lot of comments asking how it compares to Rust and Zig. The original release post does not compare Hare to other popular languages and harelang.org homepage also has no comparisons with other languages.

This is in line with every other programming language out there. I checked https://www.rust-lang.org/ and did not see a comparison to other programming languages. A similar thing with https://ziglang.org/

But in this post I will compare them anyway

The baseline

To do a proper comparison I will start with this code snippet from the Hare homepage:

use fmt;

export fn main() void = {
	const greetings = [
		"Hello, world!",
		"¡Hola Mundo!",
		"Γειά σου Κόσμε!",
		"Привет, мир!",
		"こんにちは世界!",
	];
	for (let i = 0z; i < len(greetings); i += 1) {
		fmt::println(greetings[i])!;
	};
};

This is a nice small exampe that can be used for reference and it prints Hello, world! in a few languages. What better to use as a language comparison than code that output different languages?

Comparing to Rust

To compare the Hare snippet to rust I used the rustc rust compiler:

$ rustc helloworld.ha
error: expected one of `!` or `::`, found keyword `fn`
 --> helloworld.ha:3:8
  |
3 | export fn main() void = {
  |        ^^ expected one of `!` or `::`

error: aborting due to previous error

And just as I assumed. Hare is not Rust. It won't compile with the same compiler and it has a different syntax. Honestly this was kind of expected when checking out https://harelang.org/specification/ versus https://doc.rust-lang.org/book and it already looked like comparing apples to oranges

Comparing to Zig

Lets try Zig then. From quickly glancing at the Zig homepage it seems to have similar goals to Hare but with a completely different implementation.

$ zig cc helloworld.ha
ld.lld: error: helloworld.ha:1: unknown directive: use
>>> use fmt;
>>> ^

For some reason Hare is also not Zig. While rustc got to the third line, Zig already failed on the first. It looks like it's better to use the Hare compiler for Hare code instead.