this post was submitted on 07 Oct 2024
59 points (100.0% liked)

Rust

6009 readers
6 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
all 18 comments
sorted by: hot top controversial new old
[–] UpperBroccoli@lemmy.blahaj.zone 13 points 1 month ago (2 children)

No problem, I have got some prime rust inhibitor to sell you. Easy to apply and long lasting. Shame though, newly manufactured vehicles should not already rust.

[–] TehPers@beehaw.org 3 points 1 month ago

newly manufactured vehicles should not already rust.

Seems to be a trend these days, unfortunately.

[–] diondokter@fosstodon.org -1 points 1 month ago (2 children)

@UpperBroccoli @snaggen It's about the programming language Rust :P

[–] FizzyOrange@programming.dev 2 points 1 month ago

It was clearly a joke.

[–] AsudoxDev@programming.dev 1 points 1 month ago
[–] refalo@programming.dev 6 points 1 month ago* (last edited 1 month ago) (5 children)

I think if Rust people want C and C++ devs to switch over, there needs to be a lot more documentation that's easy to follow on how exactly to do that. For example with Swift there's an amazing tutorial called Swift for C++ Practitioners that step-by-step goes over all the equivalent functionality and how to translate existing concepts over from one language to the other. I think Swift at least has the edge there with familiarity because the syntax physically looks closer to C-like languages, so when that's not the case, even more hand-holding is going to be necessary IMO.

[–] copacetic@discuss.tchncs.de 15 points 1 month ago (2 children)

Automotive developers successfully switched from barely-knowing-C to barely-knowing-C++. Surely, they will be equally successful in switching to barely-knowing-Rust.

[–] xlash123@sh.itjust.works 15 points 1 month ago* (last edited 1 month ago)

I'll take a guy who barely knows Rust over someone who barely knows C/C++ every day of the week (and twice on Sunday)

[–] snaggen@programming.dev 9 points 1 month ago (1 children)

There are lots of guides, tutorials and documentation. The responsibility is no longer on someone else, it is up to the individuals to actually read any of them. And to be honest, if you are unable to use them to learn rust, maybe your c++ skills isn't that impressive either.

https://bpbonline.com/products/rust-for-c-programmers?variant=42560853639368 is one if found using a tool called search engine...

[–] KamikazeRusher@lemm.ee -2 points 1 month ago (2 children)

There are lots of guides, tutorials and documentation.

is one I found using a tool called search engine...

Strange. That’s not what I get when I search for “Rust for C++ programmers”. I get flooded with anecdotal accounts/posts from people on Reddit and YouTube talking about their love or hate towards Rust.

Then there’s 3 hour-or-longer videos about Rust which target C++ devs directly. Two are from 2022 and 2019 with one from 2023. Only the 2022 video starts from basics with features that a C++ dev would actually need to understand, like ownership, borrowing, and references. One jumps right into multithreading ideas by discussing mutex. The other jumps into how everything is made “easier” because the compile does borrow-checking instead of having the developer manage it.

These videos probably aren’t bad, but they don’t touch on the larger “gotchas” that C++ maintainers will be scratching their head at, like explicit lifetimes, inevitable headaches with error handling, and reference/target mutability. Some of them are a good start, but they mostly focus on just technical features. It’s difficult to find a resource that helps you learn how to plan out your project early on so you’re not refactoring later due to the topics mentioned earlier.

And to be honest, if you are unable to use them to learn rust, maybe your c++ skills isn't that impressive either.

And this is why 6% of non-Rust users have cited the community as a barrier of entry. Immediate pettiness and hostility rather than trying to get the best resources into the hands of newcomers.

[–] urbeker@programming.dev 13 points 1 month ago (1 children)

You can criticise rust for a lot of things but bad learning materials I don't think can be one of them. The sheer amount of high quality learning materials is one of the selling points for the language. It was one of the areas targeted strongly to get an easy on-ramp to drive adoption.

I haven't looked for this kind of resource before but I found one that looks very high quality and up to date in less than a minute. https://github.com/nrc/r4cppp

[–] KamikazeRusher@lemm.ee 3 points 1 month ago

I didn’t say they were bad. I was pointing out that:

  1. Blaming a user for not hitting the same results on search engines is a flawed argument; my search did not present the book that was linked in the original comment, even while using the title of the book as the search phrase. It instead was a mix of forums, social media, and YouTube tutorials, all of which do not have the same depth as a good book.
  2. The material presented in some of the “Rust for C++ programmers” videos and posts focused more on direct translation of syntax. This is good “first step” material to make the user more comfortable, but again they didn’t cover the common pitfalls that a C++ developer will encounter when they’re still approaching Rust with a C++ mindset.

That said, the guide you’ve shared was in fact on the first page of my results, and is definitely a good example of the type of content that is available. What I think should take place is a compilation of similar guides and books to be posted either in the Rust forums as a pin or a YouTube playlist in the official channel, perhaps even with a small list of suggested crates to review the source code of as pristine examples.

[–] snaggen@programming.dev 4 points 1 month ago (1 children)

Ok, so we use different search engine so you didn't find this particular hit. But, do you really claim that learning material is an issue here. And about my attitude, yes, I was a bit cranky. In general, you can ask any stupid question, heck I ask stupid questions all the time and they will be answered kindly. The rust community knows that lifetimes and stuff like that is complicated.

However, I'm quite fed up with the attitude that it is someone elses obligation to spoon feed you with knowledge that exists right under the nose... and that is a very common attitude amongst the "For rust to succeed..." evangelists.

[–] KamikazeRusher@lemm.ee 2 points 1 month ago

we use different search engine so you didn't find this particular hit

Tangential due to personal curiosity, but which engine did you use? I was testing via Google while logged in. Most of my development at work and at home uses Python with some Rust once or twice a month. I just realized that when I’m searching I usually am not looking for books to purchase but instead trying to find answers in forums or Stackoverflow. Perhaps the reading material was not presented as Google was trying to personalize results to match my search habits.

I was a bit cranky

As was I, and I apologize for that since it triggered all of this.

I'm quite fed up with the attitude that it is someone elses obligation to spoon feed you with knowledge that exists right under the nose

I suggested it in response to someone else’s comment, but I believe part of the issue is a lack of a polished collection of material aimed towards newcomers from particular languages. By that I mean there’s definitely volumes of “good” material, don’t get me wrong, but learning from them individually doesn’t necessarily help with understanding how to think and plan things out with a Rust mindset.

In my own journey I’ve found many guides, posts, and videos that help you get launched into writing basic code. However I struggle to discover ones that go beyond the code to plan and anticipate pitfalls you normally may not encounter from another language. I brought up static lifetimes because halfway through coding a multithreaded project I’ll get an error about this or a struct being partially moved. At which point I would need to refactor things somewhat to make the compiler and borrow checker happy, but mentally it didn’t make sense as to how to correctly do so with what I sought to achieve.

A community-compiled collection of resources that guides you in your journey from Novice to Expert would probably help stem the tide of requests people make for getting into Rust. The official YouTube channel has some interesting videos from conferences but nothing that walks you through proficiency. And the forums, as far as I can tell, don’t have something pinned for users to point towards when someone asks the same thing.

Perhaps if people are asking to be spoon-fed when a lot is available, we should be asking them if they’ve tried to search and why they need help looking for more. Maybe it’s not laziness; perhaps there’s something specific they can’t quite find that helps fill in the gap of their understanding, and we should work towards making those resources easier to discover autonomously.

[–] BB_C@programming.dev 6 points 1 month ago

all the equivalent functionality and how to translate existing concepts over from one language to the other.

Antithetical would be the word to describe this, I think. Although I've seen such titled content.

[–] BatmanAoD@programming.dev 4 points 1 month ago* (last edited 1 month ago)

The O'Reilly book Programming Rust is very much targeted at C++ users, even if it isn't explicitly marketed that way.

I read the first edition, which predated async Rust, so I can't comment on how the second edition handles that topic. But the handling of everything else was, I think, excellent.

[–] BatmanAoD@programming.dev 1 points 1 month ago

In case you're still interested in this type of resource, here's another one I just learned about: https://google.github.io/comprehensive-rust/

It's by the Android team at Google, and while it doesn't require knowledge of C++, it seems to be intended to bring devs up to speed on the concepts required for using Rust in Android and Chromium.