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

I agree to a great extent with the article, except for the dislike for mutability. I used to be like this (dislike it), then I found Rust.

Now I prefer imperative, eager computation with (safe) mutability and even some lightweight OOP (the way Rust does it with Traits/Type-classes). It seems that it much better reflects the real world. Rust makes the mutability concerns obsolete, as you can have safety in the imperative/mutable world.

Otherwise Rust is very much functional in all the great ways explained in the article.



Immutability is not about safety (not only i guess). It is about having code that is easier to reason about.


Yeah, with Rust lifetimes it's much easier to reason about, compared to eg Java. Also, in something like Haskell it's not that your data does not change. It does change and people employ really complex idioms to facilitate that. It might be "easy to reason about", but it's definitely not easy to grasp. Lots of people find it much easier to just mutate something (hence the popularity of imperative languages).

Rust takes best of both worlds. You can both mutate, and you are sure that this is compile-time guaranteed, so you can't just try to mess with a value that this part of the code does not own.




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

Search: