News for hackers. Stuff that matters.
Re:Comprehensive Rust: course used by the Android team at Go... by dotancohen on Wednesday May 24, 2023 @05:16AM (#36055674)

  > Also, if you want to keep your sanity, you will learn to take ownership seriously. Deciding
  > what owns what and whether objects will be owned by the scope (on the stack), be owned by unique_ptr, or
  > be shared with shared_ptr is a large part of designing a C++ program.
I would love if you could expand on this. I've much experience with higher level languages such as Python, but as I get into C++ I find these nuggets of advise invaluable.
Re:Comprehensive Rust: course used by the Android team at Go... by brabel on Thursday May 25, 2023 @02:23AM (#36067608)
I've found this Youtube video (and the whole channel) very good to help understanding Rust:

https://www.youtube.com/watch?v=TJTDTyNdJdY

Agree with the quote: that's the biggest challenge with Rust... I have been trying to pretend Rust is like Java and I think that was my big mistake.

When you design anything in Rust, even the most basic stuff, you will need to decide "what owns what", unless you clone everything on every usage. Try some very simple code that requires allocation and you will quickly notice that. I am now back at Rust and redesigning all my code to make "what owns what" the first question I ask when writing anything, and that is already being very helpful.

But of course: if you don't need the performance of Rust or the small footprint, it's just not worth it spending time on stuff like that can be completely and utterly ignored in any non-systems language.

Re:Comprehensive Rust: course used by the Android team at Go... by dotancohen on Friday May 26, 2023 @02:24AM (#36080722)
Thank you.