Challenging 50 Years of Hegemony C: The New Language Hare, the Conservative in “Here”

Hare means hare, and its developers hope that this programming language will have the tenacious vitality of a hare.

This week, software developer Drew DeVault unveiled a new systems programming language called Hare, using “simple, stable and robust” as the core adjective. So is there anything special about it? Maybe this time.

More than 300 programming languages ​​have emerged in the world, and Hare has pointed the finger at the most powerful one – the C language. That’s right, Hare’s goal is to replace the most important programming language of the past 50 years.

Hare’s Value Proposition

DeVault and about 30 project contributors have been working on Hare for two and a half years. Now that the results are finally out, Hare is officially open to developers.

In a blog post, DeVault said, “Hare and C are actually very imaginary. Almost everything written in C can be written in Hare. But the important thing is that Hare is simpler than C.

Hare’s design principles are:

  1. Trust the programmer.

  2. Provide aids if programmers can’t trust themselves.

  3. Tendency to think that explicit behavior is better than implicit behavior.

  4. It is believed that a good program must be both correct and simple. “Hare uses a static type system, manual memory management, and a minimal runtime, so it’s ideal for writing operating systems, system tools, compilers, networking software, and other low-level high-performance tasks,” DeVault explained.

In an interview with The Register, DeVault also admitted that many of Hare’s design inspirations came from the C language.

DeVault emphasizes that, unlike most other language designers, they are actually very sympathetic to C. Hare just wants to make some conservative improvements to the basic design concepts in C, or it can be said that after years of practical application, re-exploring whether the C language can do better.

Ample “battery” reserves

DeVault also revealed that Hare’s standard library also incorporates the ideas of Google’s Go language, especially the built-in rich and diverse standard library — that is, various “batteries” (programming terms) — try to avoid importing additional external dependencies.

In his opinion, “Hare is designed with an emphasis on providing a rich ‘battery’ to support various use cases, helping programmers to get rid of complex external dependencies and keeping development projects within a well-manageable scope. I think the Go language Well done at this; in fact, Hare has quite a few modules (especially cryptography) that are somewhat inspired by the Go language.”

Hare’s “battery” reserves include:

  • cipher suite;

  • network support;

  • date/time operations;

  • I/O and file system abstraction;

  • Unix primitives such as poll, fnmatch, and glob;

  • POSIX extended regular expressions;

  • Parser and type checker. The standard library is a new starting point in the development of systems programming, and it also marks that developers have officially gotten rid of the legacy problems of POSIX and libc. Hare does not access the libc C language standard library by default, but is based on the qbe compiler backend. So the “Hello, world!” program in Hare looks like this:

 use fmt; export fn main() void = {         fmt::println("Hello world!")!; };  

Hare is actually quite conservative?

Allegedly Hare can also be said to be a stripped-down version of Zig. Zig is a low-level systems language that includes manual memory management, but as an alternative to C, Zig is far less popular than its rival Rust.

From another perspective, DeVault also wants to shape Hare into an effective “pit-avoiding” C language.

“I think a lot of new languages ​​that try to compete with C are going in the wrong direction. Hare is actually a fairly conservative language, and the core idea is to distill the programming experience of the past 30 years in C into a small, simple and powerful new language. language, and continue to serve developers well for the next 30 years. I don’t care much about bold innovations, just careful design of existing features.

The Hare language is still under development, and the goal at this stage is to have a stable implementation of version 1.0 that includes standard library enhancements such as TLS and raw IP socket support.

DeVault notes, “I think in the early days of the project, most of the work was focused on the language itself. But now it’s starting to bear fruit, with command-line tools, daemons like cron, and the init system management process all in place.”

DeVault also said that he is using Hare to write a key manager (Himitsu) and a set of kernels (Helios) — the Hare language’s best applications.

Himitsu can store keys as key/value pairs, and users can add additional information to each key/value pair, such as username, host, and protocol. Himitsu is also compatible with various “agents”, such as storing SSH private keys and acting as an SSH agent.

Helios is a microkernel for the x86_64 architecture, and if all goes well, it will support other architectures in the future (the team has already completed the development of a RISC-V version). At present, its functions are still relatively basic, such as starting in Long Mode mode, providing several serial drivers, setting paging and so on. “While there is still a lot of work to be done, this is a really good project that demonstrates how powerful Hare is at low-level missions.”

“I think there will be a wider range of use cases that you can explore after TLS is supported,” DeVault said.

Hare currently still relies on the BDFL (Benevolent Dictator For Life) open source governance model. DeVault pointed out that “Hare language highly emphasizes stability and immutability, so it should not require too many governance resources”, and the current project fundraising is mainly used to pay for the third-party audit fees required for the implementation of the cryptographic system.

Hare’s future plans

Regarding Hare’s development ideas, DeVault mentioned, “We have always been conservative. We hope that Hare can work stably in developers’ projects without taking up too much language learning time. In the upcoming 1.0 version , we’ll complete the specification, finalize the language design, and only make backwards-compatible changes to the standard library.”

In addition, DeVault has other plans. Currently, Hare only supports three instruction set architectures: x86_64, aarch64 and risc-v64. “We hope to expand further, adding 32-bit platforms and more other architectures. The only operating systems that can currently support are Linux and FreeBSD, and more ports will be promoted in the future. There are no plans to land on non-free system platforms at the moment, but considering Hare It is a standardized language in itself, so it can also be developed for Windows or MacOS through third-party implementations or forks if necessary.”

In terms of the standard library, the main task of DeVault et al. is to complete the encryption implementation, and the goal is to support TLS 1.2 and 1.3.

“We have paid a lot for this, we are proud of its successful birth, and we hope that more friends will use it and love it.” DeVault concluded.

Interested readers can learn about Hare at the link below:

Installation process: https://harelang.org/installation/

Tutorial: https://harelang.org/tutorials/introduction/

Reference link:

https://www.theregister.com/2022/04/26/hare_c_software/

https://harelang.org/blog/2022-04-25-announcing-hare/

The text and pictures in this article are from InfoQ

loading.gif

This article is reprinted from https://www.techug.com/post/challenge-the-50-year-overlord-c-language-the-new-language-hare-the-conservative-in-heresy.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment