> Zig•EM – a novel programming framework for developing and deploying applications which target resource-constrained MCUs, where every byte of memory and every μJoule of energy matters
I think its a control vs safety trade off. Zig forces explicit control over memory with some tools for safety. Rust forces safety with some tools for control. I only have hobbyist level experience with these languages. I find both enjoyable and I hope Zig continues to mature.
A much better source on Zig vs Rust would be Alex Kladov [0], one of the authors of TigerBeetle [1], which is one of the best Zig code bases I have seen.
The two languages have completely different design philosophies and a completely different feel leading to a completely different experience. I would say they're more different from each other than Java is different from Python. Some low-level developers will be drawn to Rust more while others will be drawn to Zig more.
I just wonder what are the advantages of using a language that is not memory-safe and it's not even stable yet...
Edit: If there's any technical reason. Of course, being a hobby project, the author is free to pick whatever he feels is most ergonomic/he likes the most.
I am not a 10x systems programmer but I have used both for MCU projects.
An expert Rust programer probably wouldn't have the same friction points I experienced.
Two of the main advantages of the Rust borrow checker is preventing use after free and iterator invalidation.
Zig's deferred free helps with the first, and hardware FIFOS, doorbells etc often caused me to have a non significant amount of unsafe code.
For me, the array safety in Zig removes most of the C foot guns, and the Rust projects decision to error on the constrained side of the static analysis dichotomy was getting in the way.
It isn't even a case of one being 'better' for me, the tradeoffs just made Zig better for this use case for me.
The idea that memory safety is a binary choice between what Rust provides and anything less than that has absolutely no grounding in either empirical or theoretical results. For example, it is true that there are good empirical reports that some high percentage (~70%) of security issues in C programs are due to memory safety, but most of those are due to lack of spatial safety, and Zig offers the same level of spatial memory safety as Rust. But in short, you get a language that's far safer than C and far simpler than Rust, which appeals to some just as Rust appeals to some (and frankly, both appeal to far fewer people than what's necessary to achieve even a medium level of success).
> Zig•EM – a novel programming framework for developing and deploying applications which target resource-constrained MCUs, where every byte of memory and every μJoule of energy matters
https://zigem.openem.org/post-002/
Thank you, I couldn't find an explanation about what is was about.
Those of you who are interested in Zig and like embedded stuff, you might find Microzig a lot simpler to grok.
It's just an SDK (for a bunch of different mcus) that has its own build tools, HAL, and drivers.
https://microzig.tech/
How does this compare to Rust?
I still fail to see where does Zig make a difference vs. Rust. What's the usefulness of the project here...
I think its a control vs safety trade off. Zig forces explicit control over memory with some tools for safety. Rust forces safety with some tools for control. I only have hobbyist level experience with these languages. I find both enjoyable and I hope Zig continues to mature.
A much better source on Zig vs Rust would be Alex Kladov [0], one of the authors of TigerBeetle [1], which is one of the best Zig code bases I have seen.
[0] https://matklad.github.io/2023/03/26/zig-and-rust.html
[1] https://github.com/tigerbeetle/tigerbeetle
https://ziglang.org/learn/why_zig_rust_d_cpp/
The two languages have completely different design philosophies and a completely different feel leading to a completely different experience. I would say they're more different from each other than Java is different from Python. Some low-level developers will be drawn to Rust more while others will be drawn to Zig more.
Oh, that's something I know, of course.
I just wonder what are the advantages of using a language that is not memory-safe and it's not even stable yet...
Edit: If there's any technical reason. Of course, being a hobby project, the author is free to pick whatever he feels is most ergonomic/he likes the most.
I am not a 10x systems programmer but I have used both for MCU projects.
An expert Rust programer probably wouldn't have the same friction points I experienced.
Two of the main advantages of the Rust borrow checker is preventing use after free and iterator invalidation.
Zig's deferred free helps with the first, and hardware FIFOS, doorbells etc often caused me to have a non significant amount of unsafe code.
For me, the array safety in Zig removes most of the C foot guns, and the Rust projects decision to error on the constrained side of the static analysis dichotomy was getting in the way.
It isn't even a case of one being 'better' for me, the tradeoffs just made Zig better for this use case for me.
The idea that memory safety is a binary choice between what Rust provides and anything less than that has absolutely no grounding in either empirical or theoretical results. For example, it is true that there are good empirical reports that some high percentage (~70%) of security issues in C programs are due to memory safety, but most of those are due to lack of spatial safety, and Zig offers the same level of spatial memory safety as Rust. But in short, you get a language that's far safer than C and far simpler than Rust, which appeals to some just as Rust appeals to some (and frankly, both appeal to far fewer people than what's necessary to achieve even a medium level of success).
If you fail to see the difference, maybe study the subject matter a little more?
Maybe you could help me a bit here.