this post was submitted on 30 Aug 2023
95 points (93.6% liked)
Programming
17558 readers
482 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I really don't see what niche it is trying to fill that isn't already occupied.
Rust is as successful as it is because it found a previously unoccupied niche: safe systems programming without garbage collector and with high level abstractions that (mostly) optimise away.
I don't think "better C" is a big enough niche to be of interest to enough people for it to gain a critical mass. I certainly have very little interest in it myself.
The killer feature (IMO) is automatic conversion of C code to Zig code (transpiling). E.g. take a C project, convert it all to Zig, and even if you don't transpile, you still get really nice compat (include C headers just like a normal input without converting). Getting a medium sized C project converted to Zig in 1 day or 1 week, then incrementally improving from there, is really enticing IMO especially considering the alternative of rewriting in Rust could be months of very hard conversion work. Transpiling isn't perfect but it seems to be a 97% soltuion.
The second advantage seems to be easy unsafe work.
BTW I don't really use Zig, and I still prefer Rust, but those are the reasons I think it has a niche of its own. Does rust already fill this space? Yeah kinda, but that's why I'd call in a niche
comptime is a huge killer feature for me. I used it to generate ARM lookup tables at compile time and it's amazing, it also removes the need for generics as types are just arguments
for example the
Vec
function accepts a type as and returns a struct that can hold arbitrary amounts of said type on the heap.I eventually switched to rust + proc macros tho (zig solution was MUCH cleaner!) because both ZLS and the Zig compiler are terrible and still needs a lot of work.
Yeah my thinking as well.
Addtionally, why I think other system language competitors like Zig or Nim aren't succeeding long-term, is because of fast growth and already big ecosystem of Rust. Zig may be better though for some use-cases (when you want to avoid all the mental overhead, and the application stays simple).