8 ms·
I think Rust has already failed in its mission to become a replacement for the existing entrenched systems programming languages. The reason is simple - it does
by ilovecaching 5y ago
I think Rust has already failed in its mission to become a replacement for the existing entrenched systems programming languages. The reason is simple - it does not offer safety without spending an inordinate amount of up front complexity. In order to replace C/C++ a language must first and foremost be simple to learn and get started with. Even though Go is 90% a rehash of other languages, it's success comes down to embracing the foibles of programmers and our need for tools that can be ramped up simply and quickly.
Rust is perhaps the language that people SHOULD be using, but likely won't. Until someone can offer something as simple and easy to learn as C and also can automatically do the things Rust provides without asking the programmer to give double in mental effort, I don't think we will replace C in a major way.
- nicoburns 5y agoIMO rust is much easier to learn than both C and C++ for anyone who is not already familiar with those languages. I suspect it will pick up adoption merely because people don’t want to deal with C or C++.
- ilovecaching 5y agoThe learning curve of Rust is extremely front loaded compared to C or C++, even though C++ might be more complex overall than Rust, that is the issue. C is simple, and I don't think anyone who has read K&R would honestly say it's harder to learn than Rust.
- nicoburns 5y agoI think that’s only true for very simple programs. As soon as you need to use a dependency C and especially C++ front load a bunch of complexity around build systems, header files, etc. C doesn’t even come with a HashMap built in, so you end up hitting this very early on.
- littlestymaar 5y agoMy C class was 12 years ago but I still remember vividly struggling with it on a relatively basic program: figuring out to make the teacher's library work, being greeted with “Segmentation fault core dumped” with zero additional clue, hence needing to install GDB and learn it… Rust is much much more gentle to learn than C: when you don't understand what a pointer is and how it works, you get an explicit error message given by the borrow checker and you can just ask on the official discord channel for beginners and you've solved your problem.
- wheelerof4te 5y ago"and you can just ask on the official discord channel for beginners and you've solved your problem." If only we had discord 12 years ago... The reason you struggled with C is simple: lack of theoretical knowledge. Your teacher should have started with core workings of a CPU before he showed you C. Maybe he did, but you simply didn't bother to learn?
- nicoburns 5y agoOne might argue that one of the problem with C is lack of good resources teaching that theoretical knowledge. For example, the Rust book has a great section teaching the difference between the stack and the heap. Most C resources I have tried to learn from in the past have just assumed that I would learn that sort of thing by osmosis.
- wheelerof4te 5y agoTheoretical knowledge is aquired at an university or by reading a book on computer science. Then, you apply that knowledge when you use C or Rust. It is good that Rust book teaches about some CS concepts, but that is not a job of a book about Rust and can be considered a bonus. To really learn about the innerworkings of the CPU, you must read a book about...the innerworkings of a CPU.
- nicoburns 5y ago
- rastignack 5y agoYet nobody has ever written & published a production grade persistent key-value store in rust. It's puzzling.
- jrop 5y agoI thought tikv was supposed to be this, but perhaps I misunderstand.
- rastignack 5y agoTikv uses rocksdb which is not written in rust.
- helen___keller 5y agoIt's not as simple as Python though, most people who are writing C++ are doing so because they already know it (e.g. from school or past work) or they have no option (building on an existing C++ codebase). Being in the position of "I need to learn a first systems language, should I pick C++ or Rust" is not very common, IMO.
- adgjlsfhk1 5y agoThe point of rust isn't to be simple. It's to prevent all the C++ people from whining that all the higher level languages have GC. In truth, 95% of them should just be using a language with GC (i.e. C#/Go/Python), and the other 5% that claim they understand how unique_ptr works should have no problem switching to rust, because they are already running an implementation of the borrow checker by hand to verify that their code doesn't have bugs.
- FpUser 5y ago>"It's to prevent all the C++ people from whining " That's some very thoughtful and noble goal. Maybe people who use C++ (and bunch of other languages) are not the ones whining.
- adwn 5y agoFor most of my projects, I would switch from Rust to a GC language in a heartbeat, provided that it 1) is as safe and as fast as Rust, or at most 1.5x slower 2) offers "fearless concurrency" and easy, safe, and efficient parallelism 3) has sum types and a good static type system 4) has great tooling and package management (see cargo) 5) has a vibrant and growing ecosystem So far, that language doesn't seem to exist. Most fail at points 1+2.
- Kelteseth 5y agoAs a full time c++ developer that just started a rust side project (with rocket.rs) to learn the language, I fully disagree. Coding is actually fun again, and it is becoming increasing harder to code c++ at my job. I constantly get reminded that gb free languages can do better. Damn rust, you ruined c++ for me :( Edit: Ok maybe a bit dramatic, but I really hoped we would get working modules with c++17 and here we are still years away...
- pjmlp 5y agoWe have working modules with C++20. Granted the only way to fully enjoy them is being on Microsoft ecosystem, but hey plenty of us are.
- silves89 5y agoThere is a way in which Rust reduces mental effort: a compiled program is more likely to work in the way you expect. It cuts out a swathe of post-compile testing and prodding, or at least, it does in my experience. I can't speak for the other people who have voted it "most loved language" six years running, but that's one of the reason why I love it. It was the phenomenal Rustlings course that got me over the learning hump.
- option_greek 5y agoI continue to be surprised by this despite logging some good number of Rust hours. Cargo run and it just works as expected even with complicated data sharing code etc. Of course most of the work gets done by the compiler safe guarding and guiding during development. People make noise about lifetimes etc but once you are ready to pay the penalty of Arc (and in most cases if you are using lifetimes you are already on the verge of using Arc). Same with using cloning as needed. End of the day, these incur a predictable and acceptable performance penalty than many other languages do while providing good safety.
- phicoh 5y agoI hope that in the future, new code written is C will be seen as similar to using unencrypted communication on the Internet. It is not about how easy is it to write rust. It is about how, as a C programmer you are going to explain that your code is safe. I know that as a long time C programmer, I still make occasional mistakes that lead to memory corruption. In production code, there are still way to many pointer bugs. Use after free, etc. That needs to end.
- FpUser 5y ago>"I hope that in the future, new code written is C will be seen as similar to using unencrypted communication on the Internet." And I hope that people stop preaching and would live and let live.
- yjftsjthsd-h 5y agoHTTPS took off when Let’s Encrypt (and to some degree Caddy) made it easy to be secure. Rust is more like, I dunno, openssl: easier than doing everything yourself by hand, but not even remotely easy.
- phicoh 5y agoUsing C instead of Rust is similar to rolling your own crypto because openssl is too hard. There are easy languages like Python or Go. But they are not suitable for many low-level, high performance tasks. Rust is competing in the domain of easy to use languages. It is about low-level system code. Edit: Rust in not competing in the domain of easy to use language
- yjftsjthsd-h 5y ago> Using C instead of Rust is similar to rolling your own crypto because openssl is too hard. Probably, yeah. At least in a world where openssl is actually so hard that doing stuff yourself seems like a reasonable idea, because theoretically secure doesn't do anything for you if the thing is too hard to actually use - there's a reason PHP utterly dominated webdev even when it sucked for security. > Rust is competing in the domain of easy to use languages. Then it loses. If you meant to write that Rust is not competing for easy to use, then it loses separately, because technically superior but too high of a barrier to entry still loses (there is a reason we aren't all exclusively running software written in Ada on OpenBSD).
- jwatt 5y agoI think it's too early to say it's failed to replace the existing systems programming languages and its trajectory looks positive. For example, in the 2019 Stack Overflow developer survey[1] only 3% of professional developers reported using Rust. A year later[2] it was 4.8% and a year after that[3] it was 6.4%. So in two years professional developer use doubled, by that metric. For reference, in the SO surveys C++ and C use was about 20% and 16%, respectively and, if anything, slowly declining (as a percentage of respondents, of course). 1. https://insights.stackoverflow.com/survey/2019#technology-_-programming-scripting-and-markup-languages https://insights.stackoverflow.com/survey/2019#technology-_-... 2. https://insights.stackoverflow.com/survey/2020#technology-programming-scripting-and-markup-languages https://insights.stackoverflow.com/survey/2020#technology-pr... 3. https://insights.stackoverflow.com/survey/2021#technology-most-popular-technologies https://insights.stackoverflow.com/survey/2021#technology-mo...
- sanxiyn 5y agoRust was created to replace C++ in Firefox. Today, lots of Rust code in Firefox, replacing C++, and no Go code in Firefox. Therefore, for this goal, Go failed and Rust already succeeded.
- hiptobecubic 5y agoNot a good example, since the Firefox experiment is going to be way more tolerant if rust's shortcomings than the rest of the industry.
- skywal_l 5y agoIf I where to write a small command line tool utility that needs to be fast, safe and lean I would definitely write it in Rust. It's got the tooling C++ don't (cargo), the ability to statically compile a minimal binary that small and fast (because we don't pay for abstraction like C++) and allow me to write reasonably clean code using functional paradigm. It is reasonably easy to interface with C code (did that recently to access libelf and fuse). Unit testing and documentation is embedded with the language. So, I agree with you, it will probably not become a replacement, but it succeeded in providing a credible alternative that has been used by many already.
- adwn 5y ago> something as simple and easy to learn as C C is neither simple nor easy to learn. Incorrect and buggy C is simple and easy to learn. If you think C is "simple" and "easy to learn", your C code is almost certainly full of undefined behavior bugs and security holes.
- wheelerof4te 5y agoTesting for off-by-ones considered hard. Gotcha.
- hiptobecubic 5y agoYou're trying to make a joke, but the flippant dismissal of all the UB is pretty much exactly what they're talking about. Writing C with a "how hard can it be?" attitude is a great way to get a CVE named after you.
- wheelerof4te 5y agoWriting software, especially systems, low-level software is hard. Writing C the language, is not hard by itself. You can't confuse problem domain with language's percieved shortcommings. Rust won't make systems programming any easier, it will still require the usage of unsafe part of the language. Only, you will also have to deal with a much more complex langage than C. That is why Rust has failed to replace C and C++.
- sharikous 5y agoIn C you find - types of varying width (how big is an int?). Rust solves that - null terminated strings. Rust's are saner - what happens in an overflow? What are implicit casts? Rust clarifies those edge cases - standard libraries often use NULL to signal error, no actually -1, no actually non-NULL. Rust has Result And I haven't even scratched the surface... All those cases are pretty basilar and happen everywhere. For me it's clear that C is much more complex than Rust if you think about the edge cases. All those safeguards are vital. But yes, Rust is a much bigger language than C so it won't replace it for really low level, scarce resources tasks. For that look at Zig
- sharikous 5y agoYou casually mention C++ along with C but you can't really put them in the same bucket. C++ is terribly, mindbogglingly, utterly, complex, its main selling points being zero-cost abstractions and compatibility with C. Perhaps we have different experiences but I don't see Rust as complex to learn with respect to C++. In C++, coming from C, the syntax is deceptively similar but you have to track in your head where the memory is, and seemingly simple operators like "=" or "()" can mean a whole lot of different stuff. Not to mention the craziness of the more advanced features. Rust is first a system programming language with zero-cost abstractions with the least possible pain, then it is a safe language, way safer than C++. In any case I am following the community and I have a hard time finding people saying C++ is nice for them. There are few people who have been coding C++ for 20+ years and "love" it but they are far and between. Almost nobody tried both Rust and C++ and continued using C++ for new projects. So I predict Rust won't replace C, they have different use cases, but it will make a dent in C++.
- pjmlp 5y agoThere is one caveat though, as long as Rust depends on LLVM, it won't fully make it.
- DerArzt 5y ago> as long as Rust depends on LLVM, it won't fully make it Why won't it? I haven't really used rust or LLVM before, so I am genuinely curious.
- pjmlp 5y agoLLVM is written in C++, so any change of Rust compiler that requires changes in the backend requires C++ knowledge, and naturally dependency on a C++ compiler to get the rust compiler binary.
- DerArzt 5y agoAh, I see what you mean now. The follow up question I have is: so what? Python is an extremely popular language that is built on C/C++. Unless you are a contributor to the rust spec, why would it matter what language the compiler is written in? The way I take it, the rust compiler team can either spend their time trying to get to being self hosted, or they can spend their time making improvements to the language.
- nu11ptr 5y agoRust isn't nearly as hard as it seems. Most people who think it is hard went up against it once or twice for a week or so and gave up. What they didn't realize is unlike some other hard languages (ie. C++) once you are over the initial learning curve, it is pretty smooth sailing, and it codes quite fast - almost like a higher level language. It has a very nice payback for the effort I think. I recommend the 2nd edition Oreilly book + writing lots of code for about a month or possibly two. After that, I think many will agree it isn't nearly as hard to write as they initially thought it would be. The biggest bonus: Writing Rust is very fun. I can't pinpoint why this is, but I totally understand why it keeps getting voted favorite language. A total joy to write.