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

I wonder how they make that robust, given that Rust isn't pure and there's no way to force a function to be pure either.


It's not very hard to stick to a pure-ish style even in languages that don't statically enforce it; JavaScript's MobX framework has the same constraint, as do React functions, and computed properties in Vue, etc. You don't really get any static help with functional purity in those cases, but thousands of programmers do it successfully every day

And while Rust doesn't strictly enforce purity, it does make it a lot easier to stick to in practice with its explicit `mut` keyword for local variables, references, and function arguments (including for the `self` argument on methods). There are various ways like RefCell to get around this if you're really trying to, but you have to go out of your way.




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

Search: