all 24 comments

sorted by: hot top controversial new old
[–] 3 points 3 years ago

Oh and .clone()

  • source
  • [–] 2 points 3 years ago* (1 child)

    I thought it was randomly adding Send and Sync traits to function signatures until rustc is happy.

  • source
  • hideshow 2 child comments
  • [–] 1 point 3 years ago (1 child)

    Replace that with golang and now we’re talking

  • source
  • hideshow 2 child comments
  • [–] 0 points 3 years ago (1 child)

    Yeah, popped in the comments to say the same.

    I dont know what my damage is with pointers…

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 3 years ago

    Follow up of: "Mmm... should I put lifecycle annotation in these 10 structs or just use and Rc and call it a day?". Rc and Box FTW.

  • source
  • [–] 1 point 3 years ago (1 child)

    Same for C, & yields a pointer to a value, and * allows you to access the data. (For rust people, a pointer is like a reference with looser type checking)

  • source
  • hideshow 2 child comments
  • [–] 1 point 3 years ago* (1 child)

    I think that's the only thing I dislike about rust. Not having to use * to dereference but later having to use is tad confusing. I know it's still clever solution but in this case I prefer c++'s straightforward consistency.

    Using ampersand never was problematic for me.

  • source
  • hideshow 2 child comments
  • [–] 2 points 3 years ago

    C++ does have the problem that references are not objects, which introduces many subtle issues. For example, you cannot use a type like std::vector, so that templated code will often have to invoke std::remove_reference and so on. Rust opts for a more consistent data model, but then introduces auto-deref (and the Deref trait) to get about the same usability C++ has with references and operator->. Note that C++ will implicitly chain operator-> calls until a plain pointer is reached, whereas Rust will stop dereferencing once a type with a matching method/field is found. Having deep knowledge of both languages, I'm not convinced that C++ features "straightforward consistency" here…

  • source
  • parent
  • [–] 1 point 3 years ago (1 child)

    This was me in courses that used C. Keep adding and removing * and & until the IDE was happy and it usually worked.

  • source
  • hideshow 2 child comments
  • [–] 1 point 3 years ago (1 child)

    I'm gonna have to borrow this book

  • source
  • hideshow 2 child comments
  • [–] 1 point 3 years ago

    So... now the rustc borrow checker is the new video game boss that is nearly impossible to beat for newcomers, right?

  • source
  • [–] 0 points 3 years ago (1 child)

    Hahaha yes tfw Rust forces you to put your shit in a Rc>>

  • source
  • hideshow 2 child comments