5 ms·
There's another thing I've noticed with Rust. I get a lot of some code benefits that I've seen from functional languages(understanding inputs/outputs, preventin
by vvanders 8y ago
There's another thing I've noticed with Rust. I get a lot of some code benefits that I've seen from functional languages(understanding inputs/outputs, preventing mutation) from Rust's ownership model.
If you want full function? Just don't pass/use anything that's mut.
Need to break that contract for performance? You still have single-ownership which gives you 90% of the above but with no performance penalty.
You still get logic errors/etc but it's a great no-compromise solution when you can afford the time to get your ownership right.
- mmirate 8y ago> If you want full function? Just don't pass/use anything that's mut. Not quite. There are still mutable globals (they just have to have to have the appropriate "I'm MT-safe" marker traits); and there's nothing preventing any function from performing any I/O that it desires. Even better, once specialization lands, generic trait-functions will be able to behave differently when called on different types, even if the special behavior isn't valid given only the public type-signature's assumptions.
- xiphias 8y agoWhat's a bit funny is that most of the work on parallizing the Rust compiler is taking out the globals (and moving everything to cached query infrastructure). I think it would improve the Rust language if anything that gets in the way of multi-threading would have to be marked unsafe