by AndyKelley · 8y ago · 0 comments
It does all the low level stuff that C does but it has some safety features as well as generics.
The standard library is usable in freestanding mode, even the data structures that allocate memory, because everything takes an allocator as a parameter.
Here are some examples:
* i386 OS: https://github.com/AndreaOrru/zen
* ARM (raspberry pi) OS: https://github.com/andrewrk/clashos
[1]: http://ziglang.org/
* Rust
* D
* Zig
* C2
* Nim
* LISP
* Ante
* Clay
Please note: I think all of the above languages (with the exception of C2) are awesome and should be looked at.
* Terra
or, if you want,
LISP: Loses In Systems Programming
- Ada
- SPARK
- Modula-2
- Modula-2+
- Modula-3
- Oberon
- Oberon-2
- Oberon-07
- Component Pascal
- Active Oberon
- Dylan
- Object Pascal
- Sing#
- System C#
- Swift
- C++ (assuming C++17)
Then the older than C, or about the same age.
- ESPOL
- NEWP
- PL/I
- PL/M
- PL/S
- PL/8
- Mesa
- Mesa/Cedar
- Algol68-W
These are the most well known ones.
Plenty of material to learn for anyone that anyone with interest in systems programming and how it evolved since 1960.
However, there are quite a few lessons on the manuals, papers and sample code from those languages, to learn about other approaches of doing systems programing.
Lessons that one can bring back to life.
For example, are you aware that ESPOL, the systems programming language for the Burroughs B5500 in 1961, about 10 years before C was created, already had the concept of UNSAFE code blocks?
Burroughs B5500 is still sold nowadays as Unisys ClearPath mainframe.
Or that IBM implemented their research OS and compiler toolchain for their very first RISC processor in PL/8, a safe systems programming language, using a compiler architecture similar to how LLVM looks like?
IBM mainframes still use PL/I variants, although new systems code is a mix of C and C++.
So plenty of ideas there to learn, even if no one is going to start writing new code in those languages.
> Ada and perhaps C++17 is the only language people are actually recommending to replace C.
I would still add Swift to that list, even if that turns out to be just like Objective-C, mainly specific to Apple platforms. Given Apple's roadmap for it.
That all being said, Zig looks pretty okay. It would be a good candidate to write an OS if you had to because the standard library looks trivially portable so you could test the userland on a known working kernel before getting it working on your new kernel.