6 ms·
>leaving Rust for Zig for the sheer enjoyment of using it instead. What do people find more enjoyable?
by tayo42 1y ago
>leaving Rust for Zig for the sheer enjoyment of using it instead.
What do people find more enjoyable?
- lagniappe 1y agoSpeaking for myself, the community is more humble and kind on the zig side, and their chats are more on-topic.
- tkz1312 1y agoZig is orders of magnitude more pleasant and enjoyable to use than Rust.
- estebank 1y ago>>> Zig is more enjoyable than Rust >> Why is that? > Zig is more enjoyable than Rust You didn't really leave the GP more informed than before.
- yubblegum 1y agoMaybe GP can be informed by skimming the following links: https://doc.rust-lang.org/reference/ https://doc.rust-lang.org/reference/ vs https://ziglang.org/documentation/master/ https://ziglang.org/documentation/master/
- littlestymaar 1y agoIt's like saying bacon is better than cheese. I totally get why some people would feel that way, but it's far from a universal feeling. Tastes are just subjective.
- lenkite 1y agoI think most folks would agree that Rust is an "acquired" taste. You need to kneel to the borrow-checker and develop something like a Stockholm syndrome before you find the language delicious.
- vatsachakrvthy 1y agoIt's not kneeling it's literally just eliminating bugs. It's kind of like saying that we kneel to logic while doing math
- YouAreWRONGtoo 1y ago[dead]
- GuB-42 1y agoThe problem I have with what I call "bondage and discipline" languages is that while it has value making sure the code is correct, it is not pleasant (for me) to work with. Sometimes I just want to try out stuff, I know there is a bug, in fact, it breaks everything, but that's exactly what I want, I will revert it once my little expertement is complete. Strict languages will refuse to run anything unless you make sure that code follow all the rules, which is useless work as you know it won't stay (because it breaks things on purpose). It is not just Rust, it is just that Rust has a lot of that. There is also C++ not allowing me to access private class members, or Python being annoying with its indentation, these are all good things for production code, but it gets in the way of experimentation. Combine this with slow compilation times and it makes Rust not very experiment-friendly, which I think is the reason why many people don't have a good time with it. As I understand it, Zig is more permissive and also has fast compilation as a design goal, which I think is a big contributing factor in making it more "pleasant".
- api 1y agoExperiments very often become production and now you have security holes and technical debt.
- GuB-42 1y agoYes, that's a tradeoff, bondage and discipline languages like Ada and Rust are popular in some fields for a reason. What I like the most is a middle ground: have a language that it permissive when it comes to generating code, but be strict with warnings. Again, problem is that too many people don't care about warnings. Way too many times, I had people call me to investigate their bugs, see a warning, point it out and tell them "here, that's your bug".
- IshKebab 1y agoI strongly disagree. I can see why you would want to use Zig, especially if you absolutely need complete low level code and only care about pretty decent memory safety (which is valid in many scenarios). But if those don't apply Rust is much nicer. Stuff like string manipulation is almost as painful as it is in C.
- the__alchemist 1y agoAs far as I can tell, Zig's niche compared to Rust is to specifically cater to certain design patterns that C and C++ support, but other languages don't. E.g., anything that uses pointer manipulation for business logic.
- IshKebab 1y agoI think it's more about low level control of allocation. You can do "pointer manipulation" in safe Rust if you need to - anything that uses arena indices is basically that, e.g. petgraph. The language wasn't really designed for it though so it isn't exactly integrated into the syntax. But controlling allocation precisely is quite difficult in "normal" Rust. Tbh I don't think it is actually that far away from Rust. It's aimed more at low level stuff, whereas Rust aims to do every level. It is more "trust me bro" than Rust's "no I'm going to check" safety. And comptime is pretty different to Rust's approach (arguably better). But apart from that they seem to have very similar goals.
- matklad 1y agoI strongly agree with your statement overall, but not in details. Regarding string manipulation, Zig has slices and comptime-checked `printf`, so that makes string handling _massively_ more ergonomic than in C. But, yeah, managing the lifetime of the printf-ed is a pain in the back, and Rust is _massively_ more ergonomic there, if managing individual string allocations is what you want to do. (though one cool thing that Zig makes easy is comptime asserting that stack-allocated buffer has the right size for the given format string). But, I do find Zig surprisingly ergonomic overall! For example, I have two Rust crate for writing glue code utilities, xflags (argument parsing) and xshell (shelling out). For TigerBeetle, I wrote equivalents: * https://github.com/tigerbeetle/tigerbeetle/blob/main/src/stdx/flags.zig https://github.com/tigerbeetle/tigerbeetle/blob/main/src/std... * https://github.com/tigerbeetle/tigerbeetle/blob/main/src/shell.zig https://github.com/tigerbeetle/tigerbeetle/blob/main/src/she... What I found is that the Zig version is significantly easier to implement and to use, for me. In Rust, those domains require macros, but in Zig it's all comptime. And memory management is relatively easy --- flags live until the end of the program, shell is just using shell-scoped arena. I am contemplating rewriting my personal scripts at https://github.com/matklad/config/tree/master/tools/gg https://github.com/matklad/config/tree/master/tools/gg to Zig for that reason. Though, Zig not being 1.0 _is_ a problem in that context --- I touch my scripts only rarely, and I don't want to be on the hook for upgrades.
- LexiMax 1y agoSome people enjoy the relative simplicity and straight forwardness of C, some folks enjoy the flexibility and zero cost abstractions C++ gives you. Some people can appreciate both. I actually like both languages for different reasons and I don't really understand why they're consistently being pitted against each other. Language wars are... for lack of a more appropriate and less-crass term... stupid.
- tayo42 1y agoWith limited time and mental energy and I woukd say the languages are fighting for attention. The war is over why should I pay attention and for territory in my head.
- LexiMax 1y agoBecause this industry is a knowledge-based industry, and it's a good idea in general to always be honing your skills and learning something new. Even if you don't have any intentions of using a new language in your day to day career, there's usually a few super-interesting morsels in there that you can add to your knowledge banks. I've personally lost count of the number of times I took a concept I learned in another language or technology stack and applied it to my day job.
- eikenberry 1y agoThere's a big difference between learning from a language and mastering a language and the competition is around the latter.
- LexiMax 1y agoIf you think that complaining about a language on the internet is an effective way to hamstring wider adoption in and of itself... I've gotta say the results leave much to be desired.
- hnlmorg 1y ago> Language wars are... for lack of a more appropriate and less-crass term... stupid. I couldn’t agree more!
- gorjusborg 1y agoZig feels like a better C with modern tooling. It is a tool that works for me. Rust feels like a better C++ with modern tooling. I am a tool that works for it.
- rishabhaiover 1y agoYou're a poet, kind sir.
- pyrolistical 1y agoThis is what people don’t understand. Zig and Rust are not competitors. Rust is a better C++ but C was the good part of C++.
- jb1991 1y ago> C was the good part of C++ This is certainly a very controversial opinion. The two languages should not really be compared or grouped together, not for at least the last 15 years, but probably much longer. Modern C++ features have been developed specifically to address all sorts of things that most C++ developers want fixed from the "C" part of the language's history.
- pjmlp 1y agoNah, C should be nuked, C++ is TypeScript for C, Microsoft was right that C was done on Windows, unfortunely they had a change of heart and eventually decided to support up to C17.
- gorjusborg 1y ago> C++ is TypeScript for C In what way? Typescript is really just an optional type system for javascript. I don't see the analogy with C/C++.
- RexFactorem 1y ago[dead]
- 1y ago
- ozgrakkurt 1y agoI find it easier to develop low level code like file format, async io library and similar stuff in zig
- anymouse123456 1y agoThey aren't even close. Trying to write Rust as a noob feels like being in a blackout swamp, waist deep in muck, fighting through thick air and trying, but failing to run from danger. Being utterly constrained in every direction. Writing Zig as a noob feels like having the clouds part to reveal a bright, sunny Spring clearing and suddenly being able to cover land in a cheerful group with clarity, purpose and focus. [Edit] Of course, this is purely subjective, obviously a skill issue and YMMV
- deleted 1y ago[deleted]
- didibus 1y agoKind of surprising, I could see why, but I find Zig more difficult than Rust, so ya, YMMV.
- lukaslalinsky 1y agoIn a way, it's a return to simpler times. I remember learning programming C and it was about programming computers, not abstract concepts. As languages got higher level abstractions, we lost touch with the computer. That's why programs are so bloated today. Zig respects that we are programming a computer, with concrete behaviours, it doesn't try to abstract things away, doesn't hide complexity, and yet gives you tools for managing it. That's why I enjoy it.
- oblio 1y agoYet computers are abstract concepts :-) And C is basically high level assembly for the PDP, which has little in common with x86, for example.
- pclmulqdq 1y agoThese arguments never really hold water for me. The C VM is flexible enough to apply to literally any piece of hardware with relatively few pains. For experienced systems programmers, it is also extremely easy to brain-compile C code. C++ and Rust are both much harder in this respect.
- pjmlp 1y agoAnd then they discover that -O3 has nothing to do with their brain compiler.
- ori_b 1y agoThe PDP is remarkably similar to x86. The complaints that people have written at length about typically come down to superscalar features not being exposed in the instruction set, which means that it can't be exposed to the programming model. On the other hand, every architecture that has tried to expose them so far has failed; nobody wants to manually apply the Tomasulo algorithm to their code, or manage shuffling data elements into and out of their cache hierarchy.
- coldtea 1y ago>Yet computers are abstract concepts :-) And food is just molecules, but we don't eat chairs because they're also molecules.
- coldtea 1y agoNot having to care for the fucking borrow checker. And far fewer concepts. And faster compiles.
- eggy 1y agoEnjoyment is part objective and a lot subjective. Mitchell Hashimoto who wrote Ghostty in Zig speaks about it here: https://youtu.be/YQnz7L6x068?si=VtH2FEAuW-SiFPHr&t=1415 https://youtu.be/YQnz7L6x068?si=VtH2FEAuW-SiFPHr&t=1415 I started with 6502 assembly and PET Basic in 1977, so for me, Zig is simpler, and jives more with me than Rust. OTOH, I chose Ada/SPARK for our product for the high-integrity, mission-critical aspect of our automation software. I programmed in Pascal back in 1988, and it has the same syntax, which I always found verbose and boring, but it is clear and structured and the concepts to achieve this level of high assurance are not too difficult. For ultiimate fun, I program in J/APL and now mainly BQN, so I am not a fan of verbosity! I would have been more attracted to Rust if it had kept ML-like syntax from OCaml and not the Algol-like curly braces of C/C++.