Hacker News new | past | comments | ask | show | jobs | submit login

I only wrote a short "helloworld.rs" in Rust, but it looks way more complex than any other language I have tried. Which is a shame because I really like the idea of safe(r) C. Is there really no simpler way to achieve memory safety without GC? I'm not talking about the borrower, but the whole language... In other words, is the complexity of Rust a consequence of memory handling or of the design decisions?



Are you doing more than this?

   pub fn main() {
       println!("Hello, world!");
   }
If you're hitting the borrow checker and you haven't found yourself at that point because a profiler or benchmark suggested it, you might just be trying to access too much of Rust's power for what you need.

You can always just throw everything inside of Rc<RefCell<...>> if you're using a single thread, or Arc<Mutex<...>>/Arc<RwLock<...>> if you're doing multi-threading. It looks expensive, but what you end up with is approx. the same accounting you find in higher-level languages, but the same guarantees.


Isn’t it kinda a catch-22 with Arc? That’s considered a form of garbage collection.

It’s like, if you can use Arc than you can use garbage collection, in which case why battle the borrow checker and just use Elixir or something which better guarantees and an easier time.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: