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]

  • @Giooschi
    link
    English
    11 day 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.