this post was submitted on 26 Oct 2023
80 points (90.8% liked)
Programming
17308 readers
203 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
That took place over two decades ago. There were no better alternatives back then. Times have changed.
This is simply not true. It's far simpler and less frustrating to work on either C or C++ for the simple reason that you can shoot yourself in the foot anywhere you'd like. In Rust, newbies have to alternative to endure the compiler enforcing its safety constraints anywhere they'd like. Rust is also a far more complex and extensive language that enforces memory safety rules that can and very often are very frustrating to handle by those who don't have a firm grasp on them.
Agreed. I found learning C decades ago was a pain in the ass. And I found learning Rust last year was a huge pain in the ass.
I believe you're mistakenly assuming it's more difficult to work with than it really is. For example, imagine telling someone that pattern matching in Rust is more difficult than constructing unions and casting pointers in C. Even something as simple as string manipulation is a lot easier to do with Rust than in C or C++. I've worked with a number of people over the years that had little experience in programming outside Rust. It's not that difficult.
You're not making the strong case that you think you are. Quite the opposite. The ease of "shooting yourself in the foot" is precisely what makes it so difficult to learn. Segmentation faults and random memory corruption make it incredibly hard to get started with programming. The compiler typically providing no help at all for diagnosing where the memory handling flaws are. You need to learn how to use a debugger to get anywhere with fixing them. Many people give up when it gets too difficult to diagnose them
Rust's constraints are very clear and concise in comparison, with a helpful compiler that will teach you how to handle memory correctly by pointing out the precise location where a borrow error occurs, and provides a suggestion for how to change your code to fix it. There's never a question about whether a value will be passed or cloned. Cargo's API documentation is also extensive in comparison to typical C or C++ documentation. It is a major boon for beginning programmers that the language ships a tool which automatically generates high quality documentation for every library you will ever use.
That's not the case, though. Some C and C++ compilers are already resilient and flexible enough to not get C and C++ to blow up in your face when you're doing unmentionable things to memory access. Some memory safety issues are only noticeable when running profilers and memory safety tools.
Keep in mind you are talking about someone taking their first steps in writing software. They are struggling to get stuff to work, and throwing curve balls at them is not going to help them get on their feet.
Also, I did not advocated for C or C++ as better options. My point is that Rust is an awful suggestion as a first language, which even the Rust community states. It also speaks volumes to Rust's unsuitability as a beginner programming language if the best attempt to refute that fact is to try to come up with worst alternatives that in the end aren't even worse at all.
Irrelevant. The point is that Rust enforces constraints that other programming languages don't. If anyone is taking their first steps, not having to deal with them leads to a far more productive and enjoyable experience. It's absurd to talk about memory-safety and performance when the target audience doesn't even understand what memory is.
The Rust community is a very diverse group of people with many different opinions. It is not a universal truth that the Rust community believes Rust to be an awful first language. I've known plenty of people who started their careers with Rust. I started my career with Rust, too. The complaint with difficulty adapting to the borrow checker has been irrelevant since the 2021 edition of Rust. The borrow checker has become smarter about rearranging borrows and automatically tagging lifetimes in most cases. The remaining constraints that the compiler enforces are also hard requirements to learn when developing software in any other language. The same practices equally apply to all software. For example, mutating an array while iterating it in Python or JavaScript will lead to unexpected behavior. Python and JavaScript's lack of a proper type system causes a lot of software to explode at runtime when you think inputs are always X but suddenly in one case it happens to be Y.
You don't need to take my word for it. Google the topic and go through all the discussions. Even the ones in Rust's own forum get mixed responses, and that community is by its very nature very partial towards Rust.
Also, framing the discussion around newbies learning Rust as a first language is a strawman. The question is not whether if someone without any prior experience in programming can or cannot make and effort and write code in Rust. The question is which language to learn.
There are many programming languages to pick and choose from, and some are renowned to be very beginner friendly. Rust is not one of them.
If you want to make a case for Rust, it's up to you to prove that Rust is a better language to take first steps than any other programming language around. In my personal opinion, it is simply not possible to claim that Rust is better for this particular usecase than quite a sizable set of programming languages, including but not limited to Python. If you want to claim Rust is better suited then you need to make a case for it, and that is a challenging thing to pull off.
I don't need Google to tell me what I already know since writing software in Rust for the last 8 years. It was your argument that Rust is not suitable for newbies. So if you want to change the topic to what language a person should learn, then Rust is most definitely at the every top. It's a life-changing experience that significantly boosts your programming skill once learned. There's a reason why it's been the most loved programming language on Stack Overflow for seven consecutive years. Not because it's hard, but because it's enjoyable to learn and use. The patterns and techniques that Rust teaches are useful in every language.