3 ms·
The Rust type system helps you catch logic errors at compile time. Same with Haskell or Ocaml.
by Aeolos 2mo ago
The Rust type system helps you catch logic errors at compile time. Same with Haskell or Ocaml.
- rustfreeforme 2mo ago[dead]
- fluffybucktsnek 2mo agoWrong. For starters, a good typing system absolutely helps catching logic errors at compile time.
- rustfreeforme 2mo ago[dead]
- whytevuhuni 2mo agoYes, except imagine the distance in correctness between Assembly and C, and triple it. Less so compared to C++ of course. The sentiment of "if it compiles it probably works" for languages like Rust and Haskell is there for a good reason.
- rustfreeforme 2mo ago[flagged]
- whytevuhuni 2mo ago> * laugh track deafening * No shallow dismissals please, tell me why you think I'm wrong. > Rust is not a major advance over C/C++ Rust adds the borrow checker (and especially with non-linear lifetimes it's an implementation like the world has never seen before, not even in Cyclone). That alone raises it leaps above both C and C++. But even without it, it still has a Hindley Milner type system (which most people considered superior to multiple inheritance), it has Sync/Send traits, the concept of UnwindSafe, proper destructive moves and affineish types, proper sum types and matching, sane iterators, lack of UB on uninit/overflow/etc, a sane module system, hygienic macros, and that's just the things I was able to pull of the top of my head right now. Not to mention, the design of its stdlib is absolutely lovely compared to what C++'s stdlib has become, and it focuses on correctness much more than most other popular languages.
- rustfreeforme 2mo ago[dead]
- fluffybucktsnek 2mo ago> In time you will learn about all of the faults and flaws in Rust, after you've suffered the pain of trying to rewrite the entire universe in it just to fix one single class of problem you are obsessed about--inevitably introducing many new bugs in the process, because that always comes with the territory. Good thing Rust doesn't just fix that one class of problems, but also provides better tooling to fix other classes too. Classes of problems that could be fixed with the other features of Rust mentioned later like the Hind... > Blah blah blah. Most of that is just added runtime complexity that I could add to C if I wanted, but why would I? ...the vast majority of these features don't even run at compile time. Some of them can't even be implemented in C. For starters, show me an example of a Hindley Milner type system implemented for C (how can someone improve a strictly compile time feature, static typing, with a runtime implementation is beyond me). Or proper destructive moves in C or C++. > Ada is the language to emulate, [...] Good thing Rust also takes from Ada. > Again, the actual successor to C/C++ looks nothing like Rust. And that would be...?
- rustfreeforme 2mo ago[flagged]
- Aeolos 2mo agoIt is obvious that you are just trolling, but for other readers: our production app went from 50-100 unexplained sentry errors in typescript to 0 sentry errors in rust. The language absolutely helps fix logic errors. It's something that becomes immediately clear as soon as you start using the language in earnest.
- fluffybucktsnek 2mo ago> Wow, what a magical language! [ waves hands vigorously ] will fix all the problems which are inevitably introduced by auto-porting from one language to another, or by manually rewriting everything from scratch. Rust doesn't obey the same laws of the software universe as other languages, it seems. Or is this a "just use magic AI bro", type situation? Nope, that's just your own prejudices speaking. We already cited features (seen in and inspired by other languages) and you handwaved them away with "I don't care". You are the one fixated on C and C++. You are a C evangelist, if I were to make a guess. And that's on you. > In the latter case, why don't I just use the to auto-magically solve my C/C++ problems, rather than rewrite the entire universe from scratch? You know, like Google claims to have done for Chromium C++ sources in this very news article? You certainly can. But to spin this the other way around: in lieu of the Bun case, why not use it to rewrite the project in Rust, Zig, D or any language of your choice (yes, even C)? Given the role harnesses have in keeping agents in check, it seems plausible that languages with stricter safety features help agents avoid common issues. > This is the type of shit noobs are always wringing their hands about as they need maximum guardrails to cover for their ineptitude. You seem to be forgetting that proper software engineering is just as much about managing developers and their skills as the actual code structure. If a tool helps noobs produce better quality code, specially ones without as many vulnerabilities, why not employ it? Also, it's not like experts are immune to mistakes either.
- fluffybucktsnek 2mo ago> It could compile and still have 10,000 logic errors. It could. Switch that to C or C++ and the amount of logic bugs is likely going to triple. > Rust is not a major advance over C/C++, only an incremental and quite limited one, [...] "Nothing ever happens." I guess you could consider borrow checking, an actual module system, type classes, enum variants, compiler-integrated macros, async/await, etc. to be just small increments. (Theoretically, you can reimplement most of this in C++, like std::variant, but they don't integrate well into the language - having to declare a type just to use std::visit is certainly not as simple as using match). > [...] which will require decades of rewriting perfectly good code to gain its dubious benefits, in the process introducing numerous other errors. "Introducing numerous other errors"? Would be interesting to see an citation on that. From what I've seen, these "new errors" were already present in the original "perfectly good code", except the original also had instances of undefined behavior and logic errors from poor type modeling. > But don't take my word for it [...] Why would anyone other than your friends take your word? You could have substantiate your claims with actual evidence. > [...] after the hype has worn off [...] Which already did. Nowadays, I see more posts about Zig and Fil-C. >[...] left with the sad mess that is Rust. I went to read your comment history to see if you elaborated on this "sad mess" of Rust, but you didn't. How about you do it here?
- astrange 2mo agoNote: when people say this about Haskell they mean "it has ADTs".