Drew DeVault introduced the Hare system programming language.

Drew DeVault, the creator of the Sway user environment, the Aerc email client, and the SourceHut collaborative development platform, has introduced the Hare programming language, which he has been developing with his team for the past two and a half years. Hare is presented as a systems programming language that is similar to C but simpler. One of Hare's key design principles is to simplify and fully trust the programmer's actions (to execute exactly what is specified, without any autonomy or implicit behavior), while providing tools to help identify common errors and issues.

The source code of the compiler and toolchain is distributed under the GPLv3 license, while the standard library code is under the MPL (Mozilla Public License). The first public release supports Linux and FreeBSD operating systems on x86_64, aarch64, and riscv64 platforms, with self-sufficient use for running on hardware without an operating system. Future plans mention support for NetBSD, OpenBSD, Illumos, Haiku, and Plan 9 operating systems, and platforms ppc64le, i686, and arm32.

The language employs manual memory management and a static type system, in which each variable must be explicitly assigned a specific type. A minimal runtime is attached for application execution. The language is optimized for low-level tasks such as operating system development, compiler creation, network applications, and system utilities, where achieving maximum performance and full control over execution is required.

A standard library of functions has been prepared for developers, providing access to basic operating system interfaces, common algorithms, and implementations of protocols and formats. The library covers areas such as input/output, file manipulation, regular expressions, encryption, network interaction, time and date operations, access to common Unix primitives (e.g., poll, fnmatch, and glob), parsing, and type checking. Separate bindings are provided for accessing the capabilities of OpenGL, SDL2, and libui.

Notable projects written in the Hare language include the Helios microkernel, the Himitsu password manager, the raytracing system, the box encryption program, the btqd BitTorrent daemon, scheduled (similar to the cron system), and toothbrush (client for the finger protocol). Future plans include stabilizing the language specification and standard library composition, implementing support for missing platforms and architectures, and adding library functions for TLS 1.2 and 1.3 support. server Future plans include stabilizing the language specification and standard library composition, implementing support for missing platforms and architectures, and adding library functions for TLS 1.2 and 1.3 support.

Example code in Hare: use crypto::sha256; use encoding::hex; use fmt; use hash; use io; use os; export fn main() void = { const hash = sha256::sha256(); const file = os::open("main.ha")!; defer io::close(file); io::copy(&hash, file)!; let sum: [sha256::SIZE]u8 = [0…]; hash::sum(&hash, sum); hex::encode(os::stdout, sum)!; fmt::println()!; const greetings = [ "Hello, world!", "¡Hola Mundo!", "Γειά σου Κόσμε!", "Привет, мир!", "こんにちは世界!", ]; for (let i = 0z; i < len(greetings); i += 1) { fmt::println(greetings[i])!; }; let x: *int = alloc(42); fmt::printfln(" x: {}", x)!; fmt::printfln("*x: {}", *x)!; free(x); const file = os::open(os::args[1])!; defer io::close(file)!; let buffer: *[65535]u8 = alloc([0…]); defer free(buffer); const n = io::read(file, buffer)! as size; io::write(os::stdout, buffer[..n])!; }; fn sort(items: []int) void = { … }; @test fn sort() void = { let items = [5, 4, 3, 2, 1]; sort(items); for (let i = 1z; i < len(items); i += 1) { assert(items[i — 1] <= items[i], "list is unsorted"); }; };

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster