Zig vs Rust. Which one is going to be future?

I think about pros and cons and what to choose for the second (modern) language in addition to C.

@[email protected]

  • asudox
    link
    fedilink
    31
    edit-2
    1 month ago

    Google has already started to use Rust in their android operating system. Linux started getting Rust stuff. Rust has the speed of C/C++ while having memory safety. Zig does not have the same memory safety as Rust, it’s a mere C/C++ alternative. Does that answer your question?

    • @teolan
      link
      31 month ago

      Windows now also has Rust in the Kernel

  • @[email protected]
    link
    fedilink
    251 month ago

    Rust. It’s a qualitative improvement over the old ways.

    The future won’t belong to Rust itself, but one of its descendants. Rust is too clunky to be the ultimate expression of its best ideas.

    • @yoevli
      link
      English
      111 month ago

      In what ways do you feel Rust is too clunky and how do you think it could be improved? Not looking to argue or even disagree necessarily; I’m just curious where that perspective comes from.

      • @[email protected]
        link
        fedilink
        41 month ago

        Here’s some of my personal complaints. I don’t in general know how to fix them.

        1. proc_macros need their own crate

        2. generics cause problems. Many useful macros can’t handle them. Try using a generic that’s a complex async function, then pass a closure to it.

        3. There’s this kind of weird mismatch where sometimes you want an enum wrapping various types, and in others generics. I find my data flows switching back and forth.

        4. async in rust is actually really good, but go does it better. I don’t think rust could match go without becoming a different language.

        5. Traits are just a big mess. Trait implementations with generics have to be mutually exclusive, but there aren’t any good tools to make them so. The orphaned trait rule is necessary to keep the language sane but is incredibly restricting. Just today I find certain a attribute macros for impls that doesn’t work on trait impls. I guess I have to write wrappers for every trait method.

        6. The “new type” pattern. Ugh. Just make something like a type alias that creates a distinct type. This one’s probably easy to fix.

        7. Cargo is truly great, but it’s a mystery to me right now how I’m going to get it to work with certain packaging systems.

        To me, Rust is a bunch of great pieces that don’t fit together well.

        • Ephera
          link
          fedilink
          51 month ago
          1. Cargo is truly great, but it’s a mystery to me right now how I’m going to get it to work with certain packaging systems.

          Yeah, Cargo itself doesn’t deal with any of the bundling after the executable is built.

          For that stuff, the efforts are certainly still ongoing. There’s no grand unified tool yet.

          If you just want e.g. a DEB file, then you probably want this: https://crates.io/crates/cargo-deb

          But if you want to do more in CI, then there’s kind of three popular options that I’m aware of.

          • just: More or less a shell script runner, and kind of like make.
          • cargo-make: A lot of effort has been put into this, it’s certainly got a good amount of features, but personally not a fan, since it makes you write a custom TOML format and then ideally you should be writing a custom script language, DuckScript. You can also use Rust scripts with it, which we tried, but there was just no way of passing parameters between tasks.
          • cargo-xtask: This is not a tool, it’s a pattern, basically just build your own build tool. It does have its downfalls, you’re not going to build good caching into your own build tool, for example. But in principle I find this quite workable, as you get to write your CI code in Rust. There’s also more and more community-made libraries to aid with that.
          • @[email protected]
            link
            fedilink
            21 month ago

            Great suggestions! One nitpick:

            But in principle I find this quite workable, as you get to write your CI code in Rust.

            Having used xtask in the past, I’d say this is a downside. CI code is tedious enough to debug as it is, and slowing down the cycle by adding Rust compilation into the mix was a horrible experience. To add, CI is a unique environment where Rust’s focus on correctness isn’t very valuable, since it’s an isolated, project-specific environment anyway.

            I’d rather use Deno or indeed just for that.

        • lad
          link
          fedilink
          English
          21 month ago

          Rust is a bunch of great pieces that don’t fit together well.

          That might change over time.

    • xigoi
      link
      fedilink
      English
      -8
      edit-2
      1 month ago

      What does Rust improve over its predecessors? The only really new thing is the borrow checker, which is only useful in very low-level programming.

      • @[email protected]
        link
        fedilink
        101 month ago

        What do you mean by its predecessor? C++? I think rust has a bunch of advantages. For one, designing a new language today gives you the benefit of hindsight meaning that they have a more cohesive set of features and a nicer standard library compared to C++ that has some bloat and cruft as a natural result of it evolving over several decades. It’s also much easier to reason about undefined behavior in rust thanks to unsafe. Algebraic data types are really nice and traits are better than classes.

        The borrow checker isn’t just useful for low level programming. One of the other main selling points is “fearless concurrency” or essentially the fact that the borrow checker can help you reason about thread safe vs non thread safe data.

  • @[email protected]
    link
    fedilink
    18
    edit-2
    1 month ago

    Zig is a modern C. Rust is a (modern) alternative to C++. So two different languages can exist alongside each other, just like C and C++.

    • @[email protected]
      link
      fedilink
      101 month ago

      The thing with rust is that it is awesome. It does exactly what it promises and everyone keeps going on about.

      If you want to talk cult talk to c developers. They are so indoctrinated. They say things like “undefined behaviour is fine you just have to code around it” “it’s great there’s almost no surface area to the standard lib as you can now trust your fellow developers to perfectly write all constructs” “yeah it causes uncountable security vulnerabilities (even when written by it’s foremost experts) but that’s unskilled developers and not a language problem”

  • @[email protected]
    link
    fedilink
    14
    edit-2
    1 month ago

    Is zig memory safe by design? If not, rust will “win”. Large companies aren’t going to hire for an unknown or unpopular memory unsafe language when they already have C or C++ - there’s just no contest.

    Last I read, zig didn’t even have a standard string library. Unless that changes, it won’t even be a viable alternative to C/C++.

    Edit: I checked and got this

    the Zig language, like C, entrusts memory management to humans, placing full trust in human development. Zig then provides some memory safety checks to ensure memory safety. However, it still lacks the strict compile-time guarantees of Rust’s ownership system and borrow checker. Therefore, when writing Zig code, developers need to pay more attention to potential memory safety issues and ensure that errors and exceptional situations are handled correctly.

    Rust Magazine

    Anti Commercial-AI license

    • @PushButton
      link
      01 month ago
      • Zig uses allocators, which will inform you if you are leaking memory.
      • Zig comes with defer/errdefer to simplify the resource cleanup (and for ergonomics).
      • Zig comes with Optionals to manage nulls.
      • Zig comes with slices (ptr + size) to manage all the bound-checking.
      • Zig automatically check for overflow/underflow arithmetic.
      • Zig will check for pointer alignments when casting between pointer types.

      => Zig is designed to make you do it right easily, and very hard to do it wrong.

      In other words, Zig will let you be, but warn you when you are doing something wrong, where Rust is like Karen who is always screaming at you for every word you are typing.

      To summarize, you really need to /want/ to fuck up to fail your memory management… If after all that you still can’t manage your memory, it might be better for you to look for another carer.

      Something is sure thou, Zig is very safe - just as it’s safe to cut my veggies with a knife. I might cut a finger and bleed a little bit, but I will not use plastic knife “because it’s safer”.

      Moreover; You are talking like if Rust is safe, all the time, which is not true in reality:

      52.5% of the popular crates have unsafe code. Therefore, in an average real-world Rust project, you can expect a significant number of the dependent crates to have unsafe code – Source

      Basically, you’re comparing a hypothetical world where Rust is always safe to a superficial glance at Zig’s capabilities to claim a “winner” here.

      And for the String library… Are you fucking serious? Do you want to compare the Zig’s Std library versus the famously tiny Rust Std library? Really?

      • @Giooschi
        link
        English
        41 month ago

        Zig uses allocators, which will inform you if you are leaking memory.

        Does that hold for the release allocator too? It also requires the leak to happen in your testing (not differently from C/C++'s sanitizers)

        Zig comes with defer/errdefer to simplify the resource cleanup (and for ergonomics).

        Which you can forget to use though.

        • Zig comes with Optionals to manage nulls.
        • Zig comes with slices (ptr + size) to manage all the bound-checking.
        • Zig automatically check for overflow/underflow arithmetic.
        • Zig will check for pointer alignments when casting between pointer types.

        All of this is good, but does very little to ensure temporal memory safety.

        To summarize, you really need to /want/ to fuck up to fail your memory management…

        I don’t see an argument for this. It still seems very much possible to fuck up temporal memory safety without realizing and without hitting it in testing.

        52.5% of the popular crates have unsafe code

        Which is not unexpected to me. Half of Rust’s point is to encapsulate unsafe code and provide a safe interface for it so that it can be locally checked. This is the only practical way that verification can happen, while C/C++/Zig basically force you to do whole-program verification (generally not practicable) or relying on testing/fuzzing/sanitizers (which will never guarantee safety).

        • @PushButton
          link
          1
          edit-2
          1 month ago

          Does that hold for the release allocator too? It also requires the leak to happen in your testing (not differently from C/C++'s sanitizers)

          I really don’t see your point here. Of course you have to catch the coding problem in your development phase; just like Rust is omitting overflow checking on release for performance reasons… I will just pass on that one, I am probably missing something here. At release, it’s a little too late to debug your code… Rust, Zig, C. Java, whatever the language.

          All of this is good, but does very little to ensure temporal memory safety.

          The allocators can be scoped to manage lifetime and the explicit nature of the memory management in Zig make it hard to miss manage the lifetime of your allocations. It’s not like C/CPP where you have to open the code and check within the function to know if some memory is allocated. There is an “init” function, if it takes an allocator, you know there is memory allocated in it (or the struct, right) so you manage that Allocator for that lifetime instead of managing 'a 'b 'c for each individual variable.

          So, basically, you are managing Arenas of variables instead of managing the lifetime of every single, individual variable, one at a time.

          What’s cool with that is you can manage the memory differently for each allocation by using a different type of allocator, which give you more control if desired.

          Do you want to talk about the covariant, invariant, contravariant and invariant in Rust? Because that’s a hell of a topic to manage the lifetime in Rust. Don’t forget, you have to manage that for /every/single/ variables, one a time. Good luck keeping you sanity in a large project.

          You are not helping yourself without those “smart pointers”.

          Here is a good talk about what I try to tell you: Individual Element Thinking

          Also, Zig has some compile time check in form of compile time assertion, checks based on the variable scopes and the defers in the code…

          Temporal memory safety is more complex than just saying “GC or Rust”. You think it is because this is what you know. What I am telling you is, there are other things out there. => Same dude, 5mins, just a couple of examples of other things

          And if I might ask, I always find it funny when a Rust programmer shits on a GC, while he’s using Arc every/fucking/where :D

          Security goes beyond “smart pointers”. Just think of the fact Rust doesn’t have shared libraries. If there are, I don’t know, let’s say 10 Rust software on my system and there is a vulnerability Because Rust also has that fyi; I would have to know exactly that I have those 10 Rust software on my system, check the dependency tree to see if there are affected by the vulnerability (fucking good luck with that!) and recompile all the ones affected to patch all of them, instead of just recompiling the shared library.

          See, that’s an issue Rust people don’t talk about, but that’s a serious issue nonetheless.

          Zig has nothing to envy Rust.

          Now, let’s talk about the language interop, the simplicity and elegance of the language, the reflection mechanism, the compile time for example…

          Rust people think that this golden cage (borrow checker) is all what matter for a language; it’s not the case.

          • @Giooschi
            link
            English
            11 month ago

            So, basically, you are managing Arenas of variables instead of managing the lifetime of every single, individual variable, one at a time.

            How does that handle stuff like vector reallocation? Does it keep both the old and the new vector allocation around until the arena scope ends? That seems very wasteful and I doubt it is how the release allocator handles it.

            What’s cool with that is you can manage the memory differently for each allocation by using a different type of allocator, which give you more control if desired.

            This creates the risk of using the wrong allocator for deallocating.

            Do you want to talk about the covariant, invariant, contravariant and invariant in Rust? Because that’s a hell of a topic to manage the lifetime in Rust. Don’t forget, you have to manage that for /every/single/ variables, one a time. Good luck keeping you sanity in a large project.

            Variance is the property of a type, not a variable. You don’t have to “manage” variance, you just have to respect it. And lifetime variance as a concept is something that exists in C/C++/Zig too and has to be respected, but the compiler generally does nothing to tell you about it. If someone doesn’t understand that then I fear for what they will write in a language that doesn’t make it clear to them.

            Here is a good talk about what I try to tell you: Individual Element Thinking

            I’m not going to spend my time watching a video just to reply to some random guy online, but I will try to give it a go later on if I have time in case it is actually interesting.

            Security goes beyond “smart pointers”. Just think of the fact Rust doesn’t have shared libraries.

            Shared libraries are in fact a massive source of unsafety since there’s almost no way to guarantee compatibility between the two sides.

            And being able to track dependencies with a proper package manager like cargo already does a pretty good job at tracking what you need to update.

            Because Rust also has that fyi

            Most of which are actually denial-of-service, unmaintained crates, or unsoundness in some crates.

            Unsoundness “vulnerabilities” which would just be considered “documentation issues” in languagues that don’t take memory safety as seriously, or maybe they would never be found because you have to go out of your way to actually hit them.

      • @talkingpumpkin
        link
        0
        edit-2
        1 month ago

        I’ve not looked into Zig yet (just like you must not have looked very closely into rust, since most of the stuff you mention as a Zig highlight is present in Rust too), so I’m not gonna argue which one may be “better” (if I had to bet, I’d say both are great in their own way - OP’s question is IMHO kinda dumb to begin with).

        I want, however, to point out a misconception: “unsafe” rust code is not code that is bugged or in any way inferior to “regular” code, it’s just code (usually small pieces) whose safety is checked and guaranteed by the developer rather than the compiler. Yeah, they really should have picked a different name for it… possibly one that isn’t literally the contrary of “safe”.

      • @calcopiritus
        link
        025 days ago

        A crate having the unsafe keyword doesn’t make the crate unsafe. The unsafe keyword just tells the compiler: “I know that what I’m trying to do may lead to memory safety issues, but I, as the programmer guarantee you that the codeblock as a whole is safe, so turn off some of your checks”.

        Using the unsafe keyword in rust is no much different than using a C library in rust.

        • @PushButton
          link
          125 days ago

          It’s when you’re at the point of saying that unsafe is safe, it’s the point where you should just shut it up kid…

          • @calcopiritus
            link
            125 days ago

            I don’t know why you are being so rude. I thought it was the rust community that was known for being toxic?

            It’s not my opinion on what the unsafe keyword means. That’s its purpose. Nobody ever wants to write unsafe code on purpose. The unsafe keyword was created to allow safe programs to be created in rust that wouldn’t be accepted by the strict rust compilers.

            In a Venn diagram, there are 2 circles: safe programs (1) and programs that are deemed safe by the rust compiler (2).

            Circle 2 is smaller than circle 1 and entirely contained inside it. However, there is no reason to not let people write programs from circle 1 that aren’t in circle 2. The unsafe keyword exists to enable programmers to write those programs in rust. However, it comes with a warning, now the programmer is the one responsible for making the program inside circle 1.

            • @PushButton
              link
              125 days ago

              Ok I understand now. You are right. Thank you.

  • macniel
    link
    fedilink
    91 month ago

    Who wants oxidised Metal when you can take off every Zig! You know what you doing!? Move Zig. For great justice.

      • @PushButton
        link
        31 month ago

        So, you are telling Rust is named after the pathogenic fungus (cause disease) and the logo is a crab, just like the logo of Cancer?

        That fits well with the language and its community. Well done!

        • @[email protected]
          link
          fedilink
          31 month ago

          What is so wrong with people being excited about a language they like? I have always found the Rust community extremely welcoming and caring.

          • @InverseParallax
            link
            English
            21 month ago

            In my entire life I have never seen anything in programming anywhere near as unimaginably toxic as the Rust community.

            They have a hammer and damnit if they aren’t going to prove its the best tool for brain surgery.

  • @9point6
    link
    91 month ago

    Which one’s in the Linux kernel?

    • @PushButton
      link
      -1
      edit-2
      1 month ago

      Rust in Linux lead retires

      “I was expecting [Rust] updates to be faster, but part of the problem is that old-time kernel developers are used to C and don’t know Rust,” Torvalds said. “They’re not exactly excited about having to learn a new language that is, in some respects, very different. So there’s been some pushback on Rust.” Torvalds added, however, that “another reason has been the Rust infrastructure itself has not been super stable.” – Source [24-09-03]

      I’m not sure that’s something to be crowing about, mate…

      • @jimmy90
        link
        3
        edit-2
        1 month ago

        the notoriously conservative Torvalds allowing Rust where C++ has been banned is worth crowing about, because he knows Rust is great, mate. nobody cares about a bunch of non-Rust coders not wanting to use Rust in the beta version of the kernel toochain

      • @Wooki
        link
        11 month ago

        lol

        Swing and a Miss. you need to catch up on what paid developers are doing. Go see what Google just announced and come back and tell us all again how right you are

  • @[email protected]
    link
    fedilink
    English
    81 month ago

    Isn’t exactly this kind of thing what is mostly responsible for the demise of Perl?

    As I heard it told, the developers of Perl worked so long & hard on the next version after Perl 5, but then veered off to make a new language (Raku) and despite the reality being otherwise, people feared so much that Perl would die (i.e. that 6 would never materialize) that in the meantime “everyone” had switched to Python (despite it clearly being an inferior language - hehehehe:-P).

    So that would be a “con” I suppose, if fights over which language is better ends up diluting efforts to work on or with either.

    • mox
      link
      fedilink
      31 month ago

      Isn’t exactly this kind of thing what is mostly responsible for the demise of Perl?

      Perl died because better tools became available.

      • @[email protected]
        link
        fedilink
        English
        11 month ago

        Python is not better in every way, it’s just more general-purpose, so has a wider range of applicability.

        Also more people use it, though by that logic we should all be forced to use Windows bc everyone else does as well?

        And Perl both still exists and is actively maintained, so it “lost prominence” rather than “died”.

        • mox
          link
          fedilink
          2
          edit-2
          1 month ago

          And Perl both still exists and is actively maintained, so it “lost prominence” rather than “died”.

          Okay, but you’re the one who called out “the demise of Perl”. Have you changed your mind? I was just responding to your question.

          For what it’s worth, I think you were right about that: Perl is dead, in the sense of no longer growing or even maintaining the reach it once had. Other languages are overwhelmingly chosen for new code, while Perl has mostly fallen into disuse outside of people who learned it in its heyday and haven’t moved on, and irrelevance outside of legacy systems. It might not be quite as much a dead language as Latin (which also still exists and sees some use) but it’s well on its way there.

          • @[email protected]
            link
            fedilink
            English
            11 month ago

            Haha, oh yes, definitely not only not actively growing anymore but fully actively declining instead - those internal politics mattered more than the actual language issues themselves, once again. Every time I see another Python update and how very many things they break, I think that thought again. Tbf newer updates breaking older code happens even with C++ too - backwards compatibility affects just everything - though the whole Python 2 vs. 3 definitely still rankles me.

            I guess I’m still having emotional trouble letting it go - but that is an absolutely perfect example of Latin, still spoken yet most definitely also considered “dead” at the same time. I guess this about sums it up:

            img

    • @9point6
      link
      31 month ago

      the demise of Perl

      You imply this is a bad thing

      • @[email protected]
        link
        fedilink
        English
        41 month ago

        I have never quite understood this mode of thinking - I think it must be an imprecise statement. Yes, improper usage of Perl coding can be bad, but then so too can C/C++ with e.g. improper memory management? Yet, I don’t see people knocking down doors to learn the memory-safe Rust (and e.g. thereby be able to contribute to the Lemmy codebase), probably bc despite it being “better”, it also has a steep learning curve (and I don’t even know but I would assume: even for someone who already knows C?). Instead, people seem to want to learn Go, or Java - okay so that’s a rabbit hole b/c they are for entirely different purposes, but anyway I mean that each language has its own balance of trade-offs.

        So while on the one hand the worst-case scenario from a poor coder for Perl seems significantly worse than for Python, there are also benefits too: doesn’t Perl run up to 20x faster than Python, which is why many places e.g. booking.com have chosen to use it? In the hands of an experienced person, perl code is quite readable, while in contrast, I just absolutely HATE aspects of Python such as whitespace delimiting and the package management, plus I don’t know if I am imagining things (is is likely) but the code just seems to me to look obtuse, by comparison.

        Sometimes I’ll use awk, other times I’ll bump that up to a Perl one-liner or even full script, still other times demand Python or for number-crunching full C/C++, or Java for whatever reason, but… for things that you want fast & easy, I don’t really see Perl as “bad”? Granted, it shouldn’t be someone’s first language these days, compared to C or Python, but what is wrong with it, like awk, continuing to exist these days? Especially if it’s not in a production environment.

        I’m listening.

        • @[email protected]
          link
          fedilink
          61 month ago

          Collaboration is a fact of life in software development.

          Therefore we must choose tools based not on a single developer’s preference, but by what their colleagues can use effectively.

          • Tools that are easy to write bugs with (C/C++)
          • Tools that are hard to learn (Perl)
          • Tools that are hard to hire for (Perl, Ruby)

          All of these should be fixed or shunned in favor of languages that are easier to hire, easier to learn, and easier to debug.

          • @[email protected]
            link
            fedilink
            English
            2
            edit-2
            1 month ago

            So *I* who am careful to write readable and safe code, have to use a non-preferred language preference b/c someone else cannot handle using it properly?!

            Sadly, that is the realization that I have come to as well. A chain is only as strong as its weakest link and all that… but no, really, that’s true, b/c modifications are likely to be made at some point (kinda biasing towards production there but even so, answers with perl one-liners on e.g. StackOverflow are ubiquitous, but someone would have to know the language to be able to modify them to suit their specific use-case, so also not at the same time).

            Fwiw I really did not think that Perl was hard to learn - though that was coming from the likes of assembly, various Basic styles, C/C++, and having already learned regular expressions via Unix e.g. grep and awk and sed. “Regular expressions” are quite a steep learning curve, though that’s not the same thing as Perl, and quite frankly Perl is the undisputed (iirc?) master of them all, so whether someone wanted to write Perl without those, or wanted to do try to do regular expressions without Perl, either way Perl seems good for having included regular expressions, not something to penalize the entire language for. Also, C/C++ (and Rust) has a bit of a known learning curve as well…:-) Though indeed it’s entirely fair to say that if someone were to pick just one language, then I would be hard pressed to find any justification for that being Perl. C/C++, Java, Python - all of these, depending on the situation, are fine choices, whereas Perl is absolutely niche.

            But even so, why would it follow that it would necessarily be a good thing if Perl, or let’s say awk, would fully “go away”? I kinda see Perl and awk as being in the same boat these days - both niche and powerful, yet both steadily becoming obsolete? Just b/c something else is “better” doesn’t mean that everything else must die. Except, as you mentioned, for reasons of collaboration and thus code-reuse. Even there though, putting all of our eggs into a single basket scares me: what if tomorrow Microsoft, or Google, decides to purchase the rights to Python and suddenly control that entire industry sector in one fell swoop?

            • @[email protected]
              link
              fedilink
              71 month ago

              Personal projects vs everything else:

              Did you want to collaborate with other people? Use something other people like.

            • lad
              link
              fedilink
              English
              51 month ago

              So I who am careful to write readable and safe code

              I just want to point out that it’s hard to be sure your code is readable if you don’t work with a team. More than once I saw people write “readable” code that was not readable. My own code I deemed “readable” was in fact not, as time had shown when I returned to fix something. So, the cited part looks a bit arrogant 😅

              • @[email protected]
                link
                fedilink
                English
                21 month ago

                Fair - and in fact doubly so bc even code that is readable in a language that someone else does not know (well) isn’t so “readable” by definition. i.e. “readable by someone who knows the language” != “readable by most developers”.

                Though having to rediscover how our code works is something shared by all languages. Perl does allow the worst there though.

  • JackbyDev
    link
    fedilink
    English
    81 month ago

    Since you’re asking today the answer is Rust because it is already more mature. In 5-10 years if you asked them the answer might be different if zig sticks around.

    This is no shade against zig! It’s just very new. It doesn’t have a 1.0 release yet.

    Also, they’re very different languages with very different goals. They aren’t necessarily competing in the same space.

  • mox
    link
    fedilink
    71 month ago

    It’s too early to tell.

    Rust has a killer feature and a tonne of buzz, but poor ergonomics.

    Zig is developing into simple elegance and wonderful interop, but has more work to do before it will be widely usable.

    It’s entirely possible that ideas and lessons taken from them will inspire another language that ends up eclipsing them both.

    • @[email protected]
      link
      fedilink
      14
      edit-2
      1 month ago

      I would say at this point in time it’s clearly decided that Rust will be part of the future. Maybe there’s a meaningful place for Zig too, but that’s the only part that’s too early to tell.

      If you think Zig still has a chance at overtaking Rust though, that’s very much wishful thinking. Zig isn’t memory safe, so any areas where security is paramount are out of reach for it. The industry isn’t going back in that direction.

      I actually think Zig might still have a chance in game development, and maybe in specialized areas where Rust’s borrow checker cannot really help anyway, such as JIT compilers.

      • mox
        link
        fedilink
        -51 month ago

        Okay, but…

        it’s clearly decided that Rust will be part of the future.

        That’s not what OP asked.

        If you think Zig still has a chance at overtaking Rust though, that’s very much wishful thinking.

        That’s not what I said.

        • @[email protected]
          link
          fedilink
          12
          edit-2
          1 month ago

          No, OP asked for a black and white winner. I was elaborating because I don’t think it’s that black and white, but if you want a singular answer I think it should be clear: Rust.

          • mox
            link
            fedilink
            0
            edit-2
            1 month ago

            I see. You replied to me, though, with commentary that doesn’t fit the question I was answering or the thoughts I was expressing. Don’t you think it would have made more sense as a reply to OP?

  • @Solemarc
    link
    51 month ago

    I assume they will both be here for the long term but for different things.

    I don’t think there’s much crossover between the two though and I’m not sure this’ll change. Rust code looks a lot like modern strongly typed languages and the memory/performance stuff is abstracted away for most use cases. While Zig looks a lot like C with pointers and writing your allocators. I think Rust is probably easier to grasp for most Devs.

    Rust is also already entrenched, android, chrome, windows, JS ecosystem, Python ecosystem, it’s everywhere. While Zig doesn’t have the adoption yet.

  • @[email protected]
    link
    fedilink
    31 month ago

    I hope that someone in the 40 comments i don’t have time to read right now has pointed out that the premise of OP is flawed for the simple reason that Rust hit v1.0 in 2015, while Zig is still nowhere near that milestone in 2024.

    So we are not even talking about the same “future” period from the start.

    So, no need to get to the second false premise in OP, which is limiting a “future” period to one successful dominating language only. Nor is there a need to go beyond these premises and discuss actual language details/features.

    • @[email protected]
      link
      fedilink
      21 month ago

      I also hope that some of the people reading this realize that OP is also the person posting all of the “stop trying to suppress C” posts.

      • @[email protected]
        link
        fedilink
        21 month ago

        🤣

        I don’t know, and I don’t want to get personal. But that’s usually a sign of someone who doesn’t even code (at non-trivial levels at least)*, and thinks programming languages are like sport clubs, developers are like players contracted to play for one and only one club, and every person in the internet gantry need to, for some reason, pick one club (and one club only) to be a fanboy of. Some people even center their whole personality around such fanboyism, and maybe even venture into fanaticism.

        So each X vs Y language discussion in the mind of such a person is a pre-game or a pre-season discussion, where the game or season is an imaginary competition such people fully concoct in their minds, a competition that X or Y will eventually and decidedly “win”.

        * Maybe that was an exaggeration on my part. Some junior developers probably fall into these traps too, although one might expect, or maybe hope, that their view wouldn’t be that detached from reality.


        I’m hoping to finally finish and send out a delayed new release for one of my older and mature CLI tools this weekend. It’s written in C btw 😄

        • @[email protected]
          link
          fedilink
          11 month ago

          Modev says they’ve been using C for 25 years, and used Rust for several years as well! Their whole schtick baffles me.

  • paw
    link
    fedilink
    English
    21 month ago

    What are your goals?

    If you want to learn another language just for the fun of it (the best reason) than learn both.

    Of you want to improve your tool set to be able to land a job, then there is no good answer. Probably some other high level language like Python, Java, JavaScript, C#. Etc.

    Also: Zig bay be easier to get started when coming from C, because it is mostly imperative.

    Rust introduces concepts from functional programming. This could be interesting for you, of you don’t have any experience in functional programming to get in touch with other programming styles. Or not, of you explicitly don’t want to learn such things.

    I use both languages, and I enjoy both. Shameless plug: I’ve written a blog post ~ 2 years ago what I like about each language: https://zigurust.gitlab.io/blog/posts/three-things/