laitimes

Challenge the 50-year-old programming language overlord C: The new language Hare, a conservative among the "heretics"

Compiled | Nuclear Coke, YanShan

Hare originally meant hare, and its developers wanted the programming language to have a tenacious vitality like a hare.

This week, software developer Drew DeVault unveiled a new systems programming language called Hare, with "simple, stable, and robust" as the core adjective. So what's so special about it? This time there may be.

With more than 300 programming languages emerging in the world, Hare has taken the finger at the most powerful one, C. Yes, Hare's goal is to replace the most important programming language of the past 50 years.

Challenge the 50-year-old programming language overlord C: The new language Hare, a conservative among the "heretics"

Hare's value proposition

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

DeVault explained in a blog post, "Hare and C are actually very imaginative, and almost every program written in C can be written in Hare. But importantly, Hare is simpler than C.

Hare's design principles are:

Trust the programmer.

If programmers don't dare to trust themselves, provide accessibility tools.

There is a tendency to think that explicit behavior is better than implicit behavior.

A good procedure must be both correct and simple.

DeVault explains, "Hare uses a statically typed system, manual memory management, and minimal runtime, making it ideal for writing operating systems, system tools, compilers, networking software, and other low-level, high-performance tasks." ”

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

DeVault emphasizes that unlike most other language designers, they actually agree with C. Hare just wanted to make some conservative improvements to the basic design concepts in C, and it can be said that after years of practical application, he could re-explore whether the C language can do better.

Ample "battery" reserves

DeVault also revealed that Hare's standard library also incorporates the ideas of Google Go, especially the built-in rich and diverse standard libraries - that is, various "batteries" (programming terms) - to avoid the introduction of additional external dependencies.

In his opinion, "Hare emphasizes providing a rich 'battery' in design to support a variety of use cases, helping programmers get rid of complex external dependencies and keep development projects within a good manageable range." I think Go does a pretty good job of this; in fact, Hare also has a fair share of modules (especially cryptographic modules) that are somewhat inspired by Go. ”

Hare's "battery" reserves include:

Cryptographic suites;

Network support;

Date/time operations;

I/O and file system abstraction;

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

POSIX Extended Regular Expressions;

Parsers and type checkers.

The standard library is a new starting point in the development of system programming, and it also marks the official removal of developers from the legacy of POSIX and libc. Hare does not access the libc C language standard library by default, but is based on the qbe compiler backend. Hence the "Hello, world!" in Hare The procedure looks like this:

Hare is actually quite conservative?

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

To put it another way, DeVault also wanted to portray Hare as an effective "pit-avoiding version" of the C language.

"I think a lot of new languages that want 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 C language over the past 30 years into a small, simple, and powerful new language that will continue to serve developers for the next 30 years. I don't care much about bold innovations, but only about the elaborate design of existing functions. ”

The Hare language is still under development, and the goal is to produce a version 1.0 that can be implemented stably and includes standard library enhancements such as TLS and raw IP socket support.

DeVault notes, "I feel that early in the project, most of the work was mostly focused on the language itself. But now that the results are beginning, command-line tools, daemons such as cron, and init system administration processes are in place. ”

DeVault also says he's using Hare to write a key manager (Himitsu) and a kernel (Helios) — both of which Hare does best.

Himitsu stores keys as key/value pairs, and users can add additional information to individual key/value pairs, such as username, host, and protocol. Himitsu is also compatible with various "proxies", such as storing SSH private keys and acting as SSH proxies.

Helios is a microkernel for x86_64 architectures, and if all goes well, it will support other architectures in the future (the team has completed the development of the RISC-V version). At present, its functions are still relatively basic, such as starting long mode mode, providing several serial drivers, setting paging, etc. "While there's a lot of work to be done, it's a really good project that demonstrates Hare's ability to do low-level tasks."

Challenge the 50-year-old programming language overlord C: The new language Hare, a conservative among the "heretics"

"I think there will be a wider range of use cases to explore with TLS support." DeVault said.

Hare still relies on the BDFL (Benevolent Dictator For Life) open source governance model. DeVault notes that "the Hare language places a high emphasis on stability and immutable features, so there shouldn't be too many governance resources needed," and the current project fundraising is mainly used to pay for third-party audits required for the implementation of cryptographic systems.

Hare's future plans

DeVault mentions Hare's development ideas, "We've always been conservative. We want Hare to be able to work consistently on the developer's project without taking up too much language learning time. In the upcoming 1.0 release, we will complete the specification, determine the language design, and make only backward compatibility 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. At present, the only operating systems that can be supported are Linux and FreeBSD, and more porting will be promoted in the future. There are no plans to land on nonfree system platforms for the time being, but considering that Hare itself is a standardized language, it is also possible to develop Windows or MacOS versions through third-party implementations or forks if necessary. ”

In terms of standard libraries, the main task of DeVault and others is to complete the encryption implementation, with the goal of supporting 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 can use it and love it." DeVault concludes.

Interested readers can learn about Hare at the link below:

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

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

Reference Links:

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

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

Read on