ZIG programming language.

Yes but AFAIK this work is his own private effort; probably started before joining Oxide. He also has r9/ an effort to reimplement plan9 in rust. I don't know how far along it is though.
 
Yes but AFAIK this work is his own private effort; probably started before joining Oxide. He also has r9/ an effort to reimplement plan9 in rust. I don't know how far along it is though.
These look really interesting. I feel an OS from the ground up in a different systems language to be a good approach rather than layers on top of C. I personally believe implementing a libc in RedoxOS was not a great decision.

The fact he is working on *two* Rust OS projects is a little suspect though. I am assuming he understands the scope. Perhaps he is just chucking things out there and seeing what sticks.
 
AFAIK a number of (ex) plan9 users are hacking on r9. Anyway you can find out from git log who did what when. The other thing to note is in both cases Dan (& others) had excellent starting points, with very good documentation! For anything new and complex, I tend to think documentation should stay at least a few steps ahead of implementation (but not too many!). At any time you are trying to match the implementation to design but the design itself is influenced by implementation choices.
 
For what it’s worth (probably not much), I use Zig for all the things these days.

It has successfully replaced C, Go, Rust and node as 1 single toolkit that does it all .. for the small set of things that I work on.

It’s much like Linux (or Unix on pcs in general) was in the early 1990s - flying well under the radar, because none of the big boys were throwing money at it or talking about it. Then, all of a sudden, it takes over phones, and takes over the cloud, and all the big boys claim they were in on it from the start.

Zig is pretty similar- a bunch of geeks with a healthy supply of money and zero corporate ties, building a set of tools that they want to use. It’s sort of like that.

I wouldn’t be too surprised if zig ends up being a universal programming toolkit eventually that is a defacto standard language for all layers for anything serious.

Rust has a lot of corporate backing at the moment, but I still think it’s an evolutionary dead end, too niche, too hostile to 3rd party code.
 
I asked about Zig. If it would be suitable for an Operating System to be built with it. They said it had trouble compiling its own language.

Other than that, I've read that Zig does a better job of compiling C and C++ than C family compilers.

I'm not sure if Zig's the answer either. Rust and Zig are predecessors to something that hasn't been created or not popular yet, which will build from lessons from those and from other newer programming languages.

Rust won't be a defacto standard. It will maintain its following, until something better than Zig comes along.

If problems with Zig can be fixed, it might be simply a replacement for C family languages, and use their libraries in those languages. That would be better than the current family of C languages and it would stay relevant as long as people don't want to leave the C family of languages. Still, another language could replace that niche.

Plus, for something not meant to be so closely interoperable with C, there will be another language.

I think Mojo is just to be the Python that replaces low level operating systems. Not sure if that's an answer, as it can take away from a fundamentally better programming language.
 
This isn't Zig central, for the main chatter of it to be here. As with any other language, the base of FreeBSD is in C, so other languages have their own ecosystem on the side of whichever OS in a different language. Take Rust for example, that on here, it requires having two ecosystems of compilers. Unlike Rust, at least Zig is said able to compile C code itself. Its developers recognize that is has to be somewhat compatible with a mainstream programming language.
 
Pigs will fly before C is ever replaced. It's practically the fabric of the digital world, and is ingrained in academia. Capsicum or CHERI has a much better chance of market penetration than a whole new language.
 
There's too much wanting to cling to C. While a new programming language surpassing C won't happen in the short term, the traction will start with Zig or something not out yet, it needs to happen sometime. I think Zig is close, but something new will learn the lessons of Zig and other programming languages, and be the one that gains popularity. Zig would be suitable, but it needs to be something a little better without the design flaws they didn't foresee when creating it. Hopefully the ones who made these languages eventually contribute together for that.

It needs a better name. If Zig were created at the time of C++, it would be in much wider use now, but it wasn't, because it needed to learn the lessons of Rust, Golang and Swift which were ingenious. But if it were made at an earlier time, even those other languages, Zig would be harder to replace, and there would be fewer reasons to, and there would also be more clinging to it, with more reason to. This means, it's better to wait for something better now than to stick with Zig. Or Zig correct them for a next major release, and rebrand to change the name. I rather see the next language be based on Zig, with its creator on board.

However, one thing which may not be good to replace in the short term is the C libraries, and Zig and a few other modern languages are meant to make use of those. Those won't be replaced for a long time, and won't be for what will in the long term become legacy operating systems.
 
Pigs will fly before C is ever replaced.
An OS built using a safer than C language will happen faster than you may guess. I don't much like rust but right now it seems the most likely candidate. C will not be fully replaced in the Userland for a long time and there will be need to maintain their dependencies (include files, libraries) but more and more new s/w will be written in something other than C (& hopefully C++).
Capsicum or CHERI has a much better chance of market penetration than a whole new language.
There have been multiple capability based systems for many decades but somehow they never really take off so I doubt CHERI will break through, unless they solve the "ease of use" problem.
 
I don't have a dog in this event, but I do believe the decades of compiler optimization has been overlooked in favor of the latest and greatest high level language.
Smart compilers are pretty efficient at turning newbie spaghetti code into an optimized binary.
 
I don't have a dog in this event, but I do believe the decades of compiler optimization has been overlooked in favor of the latest and greatest high level language.
This is why compilers for many of the newer languages plug into llvm to take advantage of its optimizations.
 
An OS built using a safer than C language will happen faster than you may guess.

I think you're underestimating how difficult it is to write an operating system; let alone a high performant, stable one. Even if someone were to successfully write one; you still have to battle test it in production... for years. Think of how many engineering hours went into ZFS. I wouldn't want to battle test something like a VM subsystem, a scheduler or a crypto library with an unproven shiny language.

There have been multiple capability based systems for many decades but somehow they never really take off so I doubt CHERI will break through, unless they solve the "ease of use" problem.

ARM has already incorporated CHERI into their morello development boards. The Foundation and friends have done the heavy lifting. All it takes is one popular OEM to take it, and run with it. If memory safety in production systems is the goal; it's probably not a whole ass new language, but incremental improvements on top of what already exist. FreeBSD (ie. capsicum, CHERI) is already there.
 
There is not even one book regarding zig.
That may be correct. Packt Publishing usually has the most books on newer software and programming topics. It even has highly niche topics within highly used software and languages that are too impractical for most uses. That's the first place I would look, and it's not there either.

https://ziggit.dev/t/a-note-about-zig-books-for-the-zig-community/738 is interesting, bc it says some users were contacted by publishers interested in writing a book for Zig.
 
"Many people consider Zig a modern alternative to C" - Is there something significantly different in Zig or it is simply alternative syntax and somebody's ambition to make new language?
 
"Many people consider Zig a modern alternative to C" - Is there something significantly different in Zig or it is simply alternative syntax and somebody's ambition to make new language?
The point is not only in difference but also in similarities, which are:
  • compilation to native machine code
  • static typing (Zig is more pedantic here)
  • manual memory management, no GC in any form
  • no OOP stuff
  • no exceptions (I mean try/catch)
Try to find a (relatively new/modern) language with such properties. Rust and Zig, maybe some other (I just do not know). D/Nim - disable GC and you do not have standard library.

As to differences... well, here are some, by my random choice:
  • more convenient generic data structures (so called comptime instead of void* or macro acrobatics)
  • structs/enums acts like namespaces, you can embed functions and call them with dot syntax
  • defer/errdefer for cleanup code instead of goto (but I personally like goto approach more, TBH)
  • build system use same language (Zig), no Makefiles
I think it's better to try it and you will see yourself.
 
Back
Top