Jump to content

Draft:Hare (programming language)

From Wikipedia, the free encyclopedia
Hare
Designed byDrew DeVault
Stable release
0.24.2 / 2024-7-14
Typing disciplineStatic, strong, inferred, structural
Memory managementManual
Platformx86-64, ARM64, riscv64
OSCross-platform: Linux, FreeBSD, NetBSD. OpenBSD
(Unofficially: MacOS)
Filename extensions.ha
Websiteharelang.org
Influenced by
C, C++, Go, Rust, Zig

Hare is an imperative, statically typed system programming language created by Drew DeVault.[1]

The language began development in December 2019 and was initially released on April 25, 2022.[2] Hare aims to be a lightweight, type safe, and intuitive alternative to C.[3]

Goals

[edit]

The goals of Hare's design are:

  • To create a "conservative" successor to C, offering polish with minimal bloat.[2]
  • The ability for any single programmer to fully understand the Hare toolchain.[4]

Not a C replacement

[edit]

According to its creator, Hare does not intend to replace C in all its areas of application:

"Hare is not a “kitchen sink” language: Hare does not attempt to solve every problem, but it does strive to solve the problems we’re interested in well."

[...]

"Hare aims to be successful within its niche for the programmers that find its ideas compelling, and nothing further. [...] I was pretty frustrated to see the “Hare is a C replacement” mantra repeated in the media despite issuing no such claims."

– Drew DeVault, on the goals of the Hare programming language[4]

Hare gears itself towards an audience which shares its creators' philosophy of hygienic programming.

Description

[edit]

Hare is intended to offer an alternative workflow for C programmers. It is designed for low-level systems programming, marketing itself as simple, stable and robust.[5][6] The language features a static, inferred type system as well as manual memory management.[4][7] Hare's innovations upon C include full UTF-8 support, a tagged union based error handling system[8] and a context-free interpreter.[7] The language emphasises broad applicability and portability.[9]

Hare runs on Linux, as well as all BSD operating systems.[10]

A lightweight language

[edit]

The Hare compiler is lightweight, with the language as a whole geared towards portability, requiring only 1.4MB of storage.[5] Hare utilises the QBE compiler tool, unlike many modern programming languages which utilise LLVM.[4][11] It also aims to minimise reliance on external dependencies.[1][6]

Drawbacks

[edit]

The language lacks many features present in other C alternatives the likes of Zig or Rust, such as code evaluation at compile-time.[citation needed] Hare also does not, nor does it plan to in the future, natively support functionality on proprietary operating systems such as MacOS and Microsoft Windows, though there exist third-party dependencies that provide such support.[4]

The most widely criticised aspect of Hare is its complete lack of generics, requiring developers to implement their own basic data structures, such as the hash table.[12]

Examples

[edit]

Multilingual HelloWorld

[edit]

This example demonstrates the high-level nature of Hare's syntax and its inferred type system.

use fmt;

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

→ The official Hare website offers a short tutorial course.

See also

[edit]

References

[edit]
  1. ^ a b Kaur, Japsimran. "Hare programming language - A new addition to computer languages". Tech Gig. Retrieved 2024-07-18.
  2. ^ a b "Announcing the Hare programming language". harelang.org. Retrieved 2024-07-07.
  3. ^ "The Hare Programming Language". vladh.net. 2022-04-24. Retrieved 2024-07-18.
  4. ^ a b c d e "Frequently asked questions". harelang.org. Retrieved 2024-07-07.
  5. ^ a b "The Hare programming language". harelang.org. Retrieved 2024-07-18.
  6. ^ a b Claburn, Thomas (2022-04-26). "Heresy: Hare programming language an alternative to C". The Register. Retrieved 2024-07-18.
  7. ^ a b "Hare's advances compared to C". harelang.org. Retrieved 2024-07-18.
  8. ^ "Safety features of the Hare programming language". harelang.org. Retrieved 2024-07-19.
  9. ^ Developer Voices (2023-12-06). Will we be writing Hare in 2099? (with Drew DeVault). Retrieved 2024-07-18 – via YouTube.
  10. ^ "Installation guide — Hare documentation". harelang.org. Retrieved 2024-07-18.
  11. ^ "What is LLVM? The power behind Swift, Rust, Clang, and more". InfoWorld. Retrieved 2024-07-18.
  12. ^ Eini, Oren. "Criticizing Hare language approach for generic data structures". Ayende. Retrieved 2024-07-19.
[edit]