Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

See as someone who knows Rust fairly well.

  let &mut                       -- Essential keywords.
  writer =                       -- Duh
  Writer<T>                      -- Generic types.  Important.
  ::writer::new                  -- Boilerplate.
  (connection.clone()).clone;    -- Relentless cloning is a big problem.
  ... 
  .unwrap                        -- "Consistent names for optional types," is an issue in Rust.  Every module has different jargon for Some(x).
Rust certainly isn't perfect. The borrow checker creates... awkwardness, that requires .clone hacks to solve.

Flip-side is, I'm coding in CMake right now. I've had to create multiple bash scripts for manually deleting my build files and general day to day.

Software is a young profession.

Everything is shit.



I feel like those clones don't get enough attention. At a glance, you don't really know what those clones are doing. Is it allocating, is just increasing reference counter? Makes code hard to understand


clone() makes an immutable, deep copy/recursive copy of the original data structure.

clone() itself makes perfect sense. Why the programmer needed those clones... is a legitimate issue with Rust.

In my experience so far, it's usually to hack around an interaction between the borrow checker and the output of a function constructed using dot syntax.


> clone() makes an immutable, deep copy/recursive copy of the original data structure.

No. clone() calls std::clone::Clone::clone. For many std collections that means deep/recursive copy.

For custom data structures, it can mean anything. It depends entirely on your implementation of the Clone trait.


Asking as someone who has tried learning Rust but didn't get very far, doesn't unwrap essentially mean "this might panic but I don't care to implement error handling here"?


Yes, it would panic. Typically you handle the Result rather than unwrap directly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: