11 ms·
There are many funny comments in here but I think they are all valid in a tragic-comic way. Rust is actually that hard that only a small share of developers wil
by jhoechtl 3y ago
There are many funny comments in here but I think they are all valid in a tragic-comic way. Rust is actually that hard that only a small share of developers will ever master it and those who master will be certainly the more intelligent one.
- EspressoGPT 3y agoMore persistent, not more intelligent.
- deleted 3y ago[deleted]
- robertlagrant 3y agoI don't know if this is true compared to C++. It's not as though it's easy to pick up a C++ codebase. Some languages, yes, but I wouldn't say C++ is one of them.
- agluszak 3y agoRust isn't hard. Programming in general is hard. Rust makes this difficulty explicit.
- jvanderbot 3y agoThis is a very good way of looking at it, actually.
- anonzzzies 3y agoAgreed, however, Rust is now treated like the hammer that also plagues js/ts. A GCd language is still just easier to use.
- cyber_kinetist 3y agoOr I would say, programming in general is already hard. Rust makes it even more difficult… The reason is that actual common memory safety mitigation strategies in real life involve using some kind of smart pointers (same with Rust and C++), or using indices with bound checking (same with Rust and C++, it’s just that C++ STL has this off in Release mode by default…). For both languages, trying to avoid these runtime mitigation strategies (which affects performance) will require doing some level of unsafe stuff which the compiler doesn’t help with you (the unsafe semantics of the two languages are actually similar since Rust relies on LLVM which relies on C semantics). So ultimately, the borrow checker doesn’t seem worth it if you actually think about the cognitive overhead and headaches it brings. The only reason Rust has an edge over C++ is that it has sane defaults and a better standard library (ah only if C++ had a sane way of initializing values…)
- hmfrh 3y ago> So ultimately, the borrow checker doesn’t seem worth it if you actually think about the cognitive overhead and headaches it brings. You quite literally also have to "borrow check" C/C++ in order to have a well formed program, just without any compiler assistance.
- cyber_kinetist 3y agoFor heap-allocated objects, there is a way to do borrow checks at runtime if you want (there's something called constraint references, explained in https://verdagon.dev/blog/raii-next-steps https://verdagon.dev/blog/raii-next-steps.) For structs that I do not want to heap-allocate, they're usually POD types and in arrays (which you can bound check), so there's not much to think about borrowing. The more concerning issue I usually have is about about initializing the values correctly (which usually Rust doesn't help, when reasoning about performance-sensitive code).
- estebank 3y ago> For structs that I do not want to heap-allocate, they're usually POD types and in arrays (which you can bound check), so there's not much to think about borrowing. Both situations which also apply to Rust. Whenever the borrow checker complains you can do exactly the same thing. > The more concerning issue I usually have is about about initializing the values correctly (which usually Rust doesn't help, when reasoning about performance-sensitive code). You can use a type-state machine, where the only way to construct the final value is by calling all of the appropriate methods that change the type parameters on the Self type. When that gets compiled it ends up as either a single memcopy of values, or you can make the Self type hold a MaybeUninit value to make the partial construction with no copy at the end possible. I actually implemented that for fun and as it turns out already existing crates that held every field in an Option and then built the final value from those ended up being faster. C'est la vie.
- MrJohz 3y agoOne of the things I found interesting about this paper is that they find that there were more contributors in Rust projects. The first headline I saw posted from this paper was that first time contributors to Rust projects are 70× less likely to introduce vulnerabilities than first time contributors to C++ projects, and my immediate gut reaction was that this could be explained if the Rust developers were generally more experienced programmers. But as the abstract points out: > We also found that the rate of new contributors increased overall after switching to Rust, implying that this decrease in vulnerabilities from new contributors does not result from a smaller pool of more skilled developers, and that Rust can in fact facilitate new contributors. Which seems to imply the opposite of what you're suggesting, i.e. it implies that Rust makes contributing easier and safer than C++. I also want to point out that your comment isn't accurate about how Rust's unsafe works: > [T]rying to avoid these runtime mitigation strategies [...] will require doing some level of unsafe stuff which the compiler doesn’t help with you (Emphasis my own.) This is inaccurate — the borrow checker is not turned off inside of unsafe blocks, but instead you are given a handful of extra APIs to use. Those extra APIs can be used to do things that the borrow checker would not normally allow (e.g. by converting checked pointers into raw pointers, and then inside the unsafe block, dereferencing those raw pointers), but the borrow checker is still active, and still catches all the same errors as before.
- Tade0 3y agoThe only difficulty that I see in Rust is that sometimes I know that something is safe, but the compiler has to disagree based on what it is able to infer. It's been a while since I last did something in Rust, but I remember that the shift to Rust 2018 was a huge step forward in this regard.
- rgoulter 3y agoI feel like Rust makes you pay a big cost upfront, and the benefits are often not worth that cost. It's easier to program if I don't have to worry about ownership/lifetimes. -- Garbage Collection allows not needing to worry about lifetimes; and preventing the same value from being mutated from multiple places in the code generally isn't such a significant problem. With high level programming (in JavaScript), you don't have to pay those costs. I like to believe that Rust's strict discipline about ownership/lifetimes encourages code that's fast/lightweight, though.
- oneshtein 3y agoIf programmers will learn Rust as first language, it will be natural to them. I use Rust since version 1.0, and I like that borrow checker helps me to find bugs at design state, where they are least expensive to fix.
- usrbinbash 3y ago> If programmers will learn Rust as first language Imagine a person who just started learning about programming. A person who may still be tripped up by the fact that `=` and `==` are completely different things here. Imagine that person. And now imagine explaining to that person a language, that even many experienced and skilled software developers say is significantly harder to learn than the average programming language. Sorry, but when I think about a good teaching language, Rust isn't the first thing that comes to my mind.
- baq 3y agoAnd neither is C/C++, in which you have to follow all the borrowing rules except the compiler maybe sometimes warns you about something instead of always erroring out. Python, go or (a bit less so) typescript are nice beginner languages.
- usrbinbash 3y agoC++ isn't, but C was my first programming language, and I am thankful for this to this day. Because C in and of itself, is an incredibly simple language. It is made complex in libs, usually by abusing macros, or by trying to shoehorn it into OOP, FP, or whatever other paradigm is currently being idolized. > Python, go Go yes, Python no, and I am saying that as someone who does alot of work in Python and loves both languages. Because Python isn't simple. It looks simple in trivial code, but hides an enormeous amount of complexity and magic not-so-far beneath the surface. In addition, it completely fails at teaching core concepts of memory, and dances around the topic of types.
- FrustratedMonky 3y agoAgree. Python is "easy" because it will gloss over a large number of 'errors' and just call it a day and let it run.
- rapsey 3y agoYou don't need to master all aspects of a language to write code for it. The point is beginners who do not master all of it are not shooting themselves in the foot anywhere near as much as C++ beginners.
- anon23432343 3y agoI'm not smart at all. Like avg at best. But still I'm learning and using Rust for a project. Its about the willingness to break that wall down you have in your head not about how intelligent you think you are. The most intelligent devs at least from there own opinion have written the most shity code I have seen.
- ecshafer 3y agoRust is harder than C++ to write a linked list in, or other “more complex than hell world” programs. But large applications i think it ends up being easier than C++. As far as mastering goes, i think far fewer people master c++ just on account of c++ being a massive language. Not only is it a massive language, but its a language with a spec, 3 major compilers, and not all of them agree on everything.
- oneshtein 3y agoSingle linked list is easy to implement in safe Rust. Double linked list is the single linked list with additional pointer (instead of reference) back to parent node. Pointers are unsafe, so use "unsafe" keyword when dereferencing them.
- baq 3y agoUm what does it say about C++ then? Getting a program to compile doesn’t mean it’s an easier language, it’s just deceiving
- dvt 3y ago> Rust is actually that hard that only a small share of developers will ever master it Kind of disagree here. Don't really think it's that much harder than C++, just hard in a very "annoying" way. Which, given its purpose, is a good thing. Making the borrow checker happy is mostly an exercise of going up and down method call chains to see where you screwed up. Or verbosely wrapping stuff in Arc<Mutex<T>> to make it a shareable resource.
- Run_DOS_Run 3y agoC++ is memory-unsafe and a Google search will not always return the latest and safest features, but raw pointers and C-like code. As a beginner, you often don't realize this. Rust makes it a little more difficult for you with "unsafe" blocks and explicitly points this out to you.
- usrbinbash 3y ago> and those who master will be certainly the more intelligent one. Rust isn't about being more intelligent, Rust is about being willing to jump through more hoops to get a guarantee that small subset of errors may not be in the executable.
- bborud 3y agoA good language amplifies talent - it doesn't require it. If, as you allude to, Rust requires above average talent for producing quality code, I'd say that as a language, it can only make a limited contribution. The only meaningful target audience for a language you hope will see mass adoption is the average programmer. I don't have sufficient experience with Rust to determine whether or not only a small proportion of programmers will master it. However, if that is indeed correct, it also means that it wouldn't be worth the investment for most of the software industry to switch to Rust. Because mass adoption is, by its very nature, about what average programmers can master.
- kibwen 3y agoRust fundamentally doesn't require any more intelligence than is required to write correct C or C++ code. It actually requires less, because you're offloading the mental labor of memory management onto the compiler. If the assertion is that Rust is unsuitable for the average programmer, then the consequence would be that C and C++ are unsuitable for the average programmer... and yet average programmers have been writing C and C++ for decades. I'm closer to an idiot than I am to a genius, and yet I write Rust all the time. You'll be fine.
- bborud 3y agoI'm fairly certain you are correct.