Skip to content

Comment on Ask HN: Memory-safe low level languages?

Comments

Check out Nim. I'm using it to build an x86-64 kernel¹ (Fusion OS), and it satisfies a lot of the low-level system programming requirements with an elegant and expressive syntax. For memory management you can choose between ARC/ORC and/or manual. It has two downsides though: small community, and the BDFL can sometimes be rough to interact with.

¹https://0xc0ffee.netlify.app/osdev

I, too, have been looking for a unicorn systems programming language, but it doesn't exit yet. Here's what I looked at so far (only languages that don't rely on a GC):

- C: lots of UB, less safe (memory- and type-wise)

- C++: too complex, not a big fan of OO

- Rust: too complex, gets in the way when writing mostly unsafe kernel code

- Zig: Good, but syntax is too noisy; lacks interfaces/dynamic dispatch

- Swift: Doesn't have a good bare metal story

- D: Seems interesting, I may be looking at it (although need to use betterC mode, i.e. not all language features)

- Odin: Game programming focused, small but growing community

- Ada: Strong candidate, but it has too much ceremony

- Pony: I like the capabilities model, but tiny community

- Hare: Also tiny community, lacks polymorphism

- Hylo (Val): Experimental (mutable value semantics), too immature

- Vale: Experimental (regional memory management), seems stalled

- V: Good candidate, but mixed reviews on its claims vs. reality

- Austral: Experimental (linear types), tiny community, not much progress

- Jakt: Built for Serenity OS, not sure if it's getting enough attention

- Jai: Focused on game programming, good reviews, but currently closed source (beta)

- Mojo: (Python-like) Seems very interesting and I'd give it a try, but too focused on GPU/parallel programming; also too early for adoption

Thanks a lot for that list ! It matches pretty much what I imagined.

On a side note and coming from high-level languages, D is the easiest to learn IMHO, as it is very dev-friendly, mature enough and has a good interoperability with C libraries.

I considered for a long time nim for its syntax and "low-levelness", but my lack of knowledge in low-level languages made the learning curve too much steep for me. I think I'll switch to it when I'll have more experience.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.