> Do you feel so threatened by people creating new programming languages?
that's a lot of assumptions.
I never even said I write C code.
It feels to me that you are projecting your doubts on me to validate your choices.
I have absolutely no problem at all with programming languages, in fact I always try all the new ones I can, I can actually write code, with very different degrees of competence, in more than 30 of them, including Rust, my new language of choice to write NIF extensions for Erlang/Elixir. Thanks to rustler crate which is awesome.
> While some "innovation" actually make things worse I see a lot of interesting ideas coming from both Rust and Zig.
Never said the opposite though.
Just that a C Ruby extension is not the same thing of "writing a browser at Google in C++"
> He used Zig, not Rust.
I was referring to this sentence he wrote
Other options were not great as well. I can use Rust, but I have never been on good terms with Rust
> My main issue with Zig is that I’m scared to invest time in writing something nontrivial to see the community/adoption flounder then regret not using Rust or C++ later
This is 100% a real concern.
If I'm going to choose Zig, it's because it is SO much better on some axis that the community/adoption isn't an issue as I gain the benefits almost immediately. That means that C++ and Rust probably aren't in the scope of choice anyway.
I especially like the comment from elsewhere in thread where they are using it for scripting, of all things, because they can pop out code that builds and works on Windows and Linux. That's a good example--you gain the benefits immediately even if you later have to unwind that to something like Python.
> Rust is a very complex language; it's essentially a modern take on C++, and it fully adopts C++'s design philosophy.
This is a false and inflammatory statement, and unhelpful. It's more complex than C, but has very different set of features and type capabilities from C++ that makes it far simpler. Even for C, I would say it really is a different set of complexity. Rust brings that complexity to the fore-front, whereas C and C++ both have a significant amount of hidden complexity.
> It appeals to those who already like C++
Perhaps, but I absolutely abhor C++ (after years of working with it) and completely love Rust, so :shrug:
> Zig is a very simple language
It is. It also doesn't make many of the same safety guarantees as Rust. So there are trade-offs.
> I find it to be a very interesting take on what modern low-level programming can be.
As do I! Though, I do think people keep looking for greener fields unnecessarily.
> I feel that Zig is doing a much better job in this regard
Let's wait until Zig gets a proper specification before trying to argue that we're doing a good job. Rust is much more mature and I'm sure people have found, fixed and standardized things that we probably have never even experienced once, ever.
Right now the compiler doesn't even implement the full language.
> It seems you take an issue with the rising popularity of Rust. But let me ask you this: if you are so confident in C/C++'s superiority, why are you bothered?
I don't have a problem with Rust at all. It's a fine tool and I'd be happy to use it (and have), just like any other. I work on interesting problems and am tools-agnostic (aside from certain languages being suited or not to specific domains).
I have a problem with people who lose their objectivity as a result of their enthusiasm for Rust and go around shouting in every project like it's the most important thing to happen in the last 30 years of Computer Science. It wouldn't be such a meme if people didn't actually friggin' do this.
> Rust is a terribly complex language, there are people at FAANG companies threatening to fork the language when attempts to simplify it are proposed.
Ironically, the person I think you're referring to is actually me, and that's a strong mischaracterization of what happened. Nobody was ever "threatening to fork the language". Besides, that's irrelevant to this discussion, because none of the complexity of Rust compromises memory safety.
> I love Rust, but I think Zig solves 70% of the memory safety problem at the benefit of a much simpler language.
I don't believe the 70% number without evidence. Again, the problem that we really need to solve is complex UAF caused by unexpected interactions between components of large software systems, and I see nothing in Zig to solve that.
> but it's not a very compelling argument to avoid a language because of them.
You're looking at it from the wrong direction. Both Zig and Rust target low-level programming, i.e. domains where C and C++ are very established. You don't need a reason to avoid a language -- you need a reason to invest a great amount of effort to switch away from an established incumbent.
Now, my biggest issues with C++ are, in this order: 1. language complexity, which makes understanding and changing codebases harder, 2. long compilation times which lengthen cycles and reduce software quality, 3. lack of memory safety. Rust improves on 1 a tiny bit, and solves 3. Zig solves 1, 2, and almost completely 3. This means that I have little reason to even consider switching to Rust; I will only if it ever becomes dominant. I wouldn't switch to Zig right now -- it still needs to prove itself, but at least it's a contender, because it offers something quite radical. Rather than an improved C++, it is a whole new way to think of low-level programming, it seems to address precisely the things that bother me about C++, plus it focuses on other aspects that are very important to low-level programming, like cross-compilation.
> But why care about me, or people like me, perhaps I'm unique. It feels like Rust was designed for people as smart as the authors to use, and there's not a thing wrong with that. Myself, I prefer a small language that I can 'keep in my head', and build from there.
Rust was not designed to be difficult. It's designed to be as easy as possible without sacrificing the goals of memory safety and data race freedom. Building on a foundation like those of those other languages would result in a language that isn't safe or uses global concurrent GC.
> But please don't take offense to the assertion that the language is pretty complex compared to Go, Ruby, Python, or C.
I think that Rust actually has simpler semantics and fewer special cases than all of those.
> I see [Rust : Zig :: C++ : C] repeated a lot, especially in Zig spaces, but it doesn't really make sense to me. Rust is an excellent replacement for C, even though it has more features.
It’s the feels, not the features :) Rust code feels like C++ code, at least when you’re reading it (I haven’t written any worth talking about). It puts the problem domain in similar terms, it has similar transparency (or lack thereof) regarding what it’s copying or allocating or whatnot, and so on. In that respect (!) they are closer to each other than C is to either—at least vanilla C, not a DSL (“language overhaul mod”?) like GObject. And it makes sense to target the C side of that divide in a new language (though again I lack the experience to say to which degree Zig succeeds in hitting that target).
> My impression is that there's been a lot more people moving to Rust from Python/Ruby/Javascript than from C++
Is there any reason in particular you think a lot of high-level language people are moving to Rust? That is not my impression or experience at all and I struggle to think of any reason to do so besides a large, individual change in career focus. As a higher-level language user myself, I can't think of a single reason I would ever use Rust for anything. Sure, I think it's cool, and it's always good to learn new languages, but in practise it's just not suited to my domain - and I think that goes for the vast majority of us.
I would say golang has scooped off more of the dynamic language types myself, although I also consider it a productivity downgrade and/or cargo cult to mostly be ignored without compelling reason. Which is even more the case with Rust!
> However, what I've seen in the discourse of several programmers that claim to prefer Zig is the assumption that Rust is "not really that big of a deal". There's a constant minimization of the advancements both the ownership system and the safety approach provide, and a lack of recognition for the fact that the language is a "game changer" in the industry.
I think you have inadvertently worded this in a way that silently confirms what the parent poster was saying. But more generally, while I can't speak for the entirety of the Zig community, the people involved with Zig directly tend to be aware of Rust's strengths. The problem is that one of the reasons why Zig exists (and is having some level of success) is because some people just don't want to deal with abstraction-heavy code. Some people value simplicity over a complex language with a memory-safe subset.
And the value of simplicity is not just a matter of aesthetics. Simplicity is a defense against bugs, because memory safety is not the end goal, correctness is.
> To be blunt, the security of the software that runs so much of the world is way more important than the feelings of some programmers who feel that their beloved languages are under attack.
As someone that have created software in at least 7 programming languages, including Rust, I agree with you, i only disagree with the recipe and the tactics used.
The bugs will happen, and contrary to the constant hammering sales pitch, Rust will not escape from them. Its like saying we are free from uncertainty. Its a false promise and anyone with real life experience in big software that are not neurotic about security like someone that only see software under this perspective would do.
Now, i believe Rust will likely have less bugs in the end? It depends most of the coder, but taking that variable out of the way, its more likely because its design is more strong into that direction.
Cant people fix security bugs once they happen? this will be the approach be it in Rust, C++.. Rust still will have to wrap insecure parts in unsafe{} blocks anyway, the same way a C++ coder do only that its not a keyword.
Im all for Rust having the right to tell its strenghts, i like the tech and what its offering, i can see why it can be better, but lets take care of the language used and the ideology behind our wording, its all i'm asking here..
Its time for the Rust community to grow up and stop pitching by shaming other languages, projects and communities, as if its the only reasonable answer like as if was some sort of master-race of programming languages and everything else should be replaced because its garbage.
This is not true, and while i like the tech, im worried about how a culture formed around bullying "inferior" languages will become with time.
> Would it be fair to say that Zig is to C, what Rust is to C++?
I don't think that's the parallel I would draw.
Rather, I think both Zig and Rust aim to serve the use cases C and C++ do, but Zig and Rust pick different points on the tradeoffs involving safety. Zig feels like a "better C", in the sense of bringing modern language features to C, but it chooses safer rather than safe. Rust supplies modern language features as well, and chooses to prioritize safe; sometimes that comes at the expense of other factors, such as productivity or compile time. I personally prefer the point on the spectrum that Rust chose, but I think Zig still offers improvements over C.
> I hope that Rust joins the pantheon of eternal languages.
I'm torn about this. On one hand, Rust is so much better than C it is ridiculous and I really hope it does become a language with decade-long longevity.
On the other hand, Rust is the first new "systems programming" language in forever and is finally prying the door open to something other than C/C++. I'm really hoping that Rust opening the door and paving the way means that now we can get something better.
What worries me about Rust is the impedance mismatch down at the very primitive hardware level--bytes and registers. The embedded guys are doing an amazing job papering over it, but the abstractions leak through quite a lot and you have to twist things around to satisfy them.
The problem is: that's a lot of fiddly code with all kinds of corner cases. So, you either have a lot of work or you throw up your hands and invoke C (like Zig does).
> I know lots of folks who prefer C to C++, but still like Rust.
I'm one of those people, and, while I have yet to use Rust or Zig for any real work, at least so far I also see Rust as being more directly a competitor to C++, and Zig as the more direct competitor to C.
Or perhaps I should say analogue. Because, it's true, I might choose Rust over C. I'm even tentatively planning to, for one project that's still in the idea phase, and that I would normally have wanted to do in C. Though that's not really because I see Rust as being more C-like. It's more that I see choosing Rust as being perhaps more likely to be worth the extra effort than I've found to be the case for C++.
>If I may, my only piece of feedback (as someone who looked at Zig with fresh eyes) is that the syntax has lots of special chars (@, !void, .{}, &, etc). Is there a rationale published for these and other design choices (even if it's "I like it that way"). I would have expected a language with ambitious goals like Zig to take a stab at coming up with a grammar that's even simpler and cleaner than C.
That is sadly my gripe with a lot of the newer languages too. I have been looking for something to replace C for a long time, something that makes it easier to not shoot yourself in the foot. I just find most of them significantly less readable than C.
Rust seems to be going down the route of C++, hence I do not deem it a safe language at all, as I have an exceedingly hard time parsing the source and figuring out what is going on.
Zig is WAY better in that regard, but as OP mentions: all the special characters make things more difficult to parse. Calls like these (taken from the introduction page) contain so much visual clutter:
try expect(@call(.{}, add, .{3, 9}) == 12);
I sadly doubt any of this is possible to change at this stage anymore. Zig definitely seems the most promising C replacement with regards to tooling, especially cross compiling and C interop are a breeze. Truly inspiring work!
The only new C-like language that really nailed it for me syntax wise would be Nim. Very clean and easy to reason about, which - from a programmer perspective - makes it exceedingly safe to program in. It just seemingly lacks most of the safety guarantees that the compilers of other, newer languages provide.
> I think any decent developer would be put off by C to some extent.
Any decent developer would be put off by any language to some extent.
Personally, I'm more put off by Rust than C (they put me off for different reasons). Currently, the one puts me off the least is Zig, but it still has many details that I don't like.
> Well… Many Rust enthusiasts treat it either as a silver bullet or everything else as unholy (unsafe).
I don't think anyone here is saying that, at least in this thread the parent(and myself) were both careful to qualify there might be contexts that it could be useful in. If you see anyone saying that Rust solves every single problem then feel free to call them out for being full of shit :).
I'm not going to be giving my designers a Rust tutorial the same way we did with scripting Lua, you're still going to have a FFI somewhere which will require unsafe and a bit more care. However having had maintained pretty significant codebases in quite a few languages I will say that Rust code is more stable, crashes less and still runs in the same footprints as C++(C gets the codesize edge by having a much smaller stdlib and surface area). It's about knowing where your tools do well and where they have rough edges and a better tool is appropriate.
Having to switch between C, C++ and Rust codebases on a regular basis I think you're underselling the complexity of C++ and overselling how difficult Rust is. C++ has a huge surface area, you have to figure out what subset you want to use(exceptions: y/n?, RTTI: ditto, stdlib or custom containers, etc). Then you get into Rule-of-5, move semantics, template metaprogramming, undefined behaviors(don't use global constructors/destructors). I could easily list 20 years of various ways I've seen C++ explode in spectacular ways(volatile semantics anyone?).
If you want to use C, Zig, or C++ more power to ya. No one is forcing you to use Rust but for those of us who are interested in a language that isn't dragged along with decades of baggage Rust offers a compelling development story and largely delivers on the areas it aims to hit(accessible systems development, memory safety and first-class tooling in my experience).
I did, to make sure I wasn't missing something. There's nothing new there, and some things are missing. (This is not bad, Zig is still in development, but it's not exactly a new approach either.)
> only C++ and Scala contend to be as complex as Rust or more. ... If you, like me, don't particularly like complex languages, then the complexity has a cost.
This is why I linked our Reddit conversation- Rust is nowhere near as complex as C++, and its particular complexity's costs are not difficulty in reading or code review.
> If you have an alternative to achieving a similar level of correctness with a much simpler language, I would very much prefer that.
But this is exactly my point- I don't believe Zig is such an alternative! Zig and Rust both improve over C and C++'s complexity and readability, leading to some general correctness improvements; so far only Rust does anything different to address memory safety.
> rust also incurs a non-negligible ongoing productivity cost for its complexity
This isn't really consistent with my experience. Compared to writing other languages with varying levels of strictness (C, Python, Go to name a few), Rust's compiler saves me a lot of time writing tests and finding bugs.
It doesn't save me the work of fixing them, but in my experience, bugs that are hard to find and easy to fix drastically outnumber bugs that are easy to find and hard to fix.
That said, I haven't tried Zig. It's on my radar, but just haven't had a new project to start lately.
that's a lot of assumptions.
I never even said I write C code.
It feels to me that you are projecting your doubts on me to validate your choices.
I have absolutely no problem at all with programming languages, in fact I always try all the new ones I can, I can actually write code, with very different degrees of competence, in more than 30 of them, including Rust, my new language of choice to write NIF extensions for Erlang/Elixir. Thanks to rustler crate which is awesome.
> While some "innovation" actually make things worse I see a lot of interesting ideas coming from both Rust and Zig.
Never said the opposite though.
Just that a C Ruby extension is not the same thing of "writing a browser at Google in C++"
> He used Zig, not Rust.
I was referring to this sentence he wrote
Other options were not great as well. I can use Rust, but I have never been on good terms with Rust
reply