5 ms·
What's up with the "pure" keyword? Has someone managed to work on this area so that the default is pure, and the opt-in keyword is "impure" instead?
by knocte 12y ago
What's up with the "pure" keyword? Has someone managed to work on this area so that the default is pure, and the opt-in keyword is "impure" instead?
- pcwalton 12y agoRust used to work that way several years ago, but it proved too inconvenient and was removed.
- comex 12y agoRust doesn't currently enforce pure functions at all; there is no 'pure' keyword. Here is an old mailing list post related to this decision - note that because it is 2 years old and Rust has been in a state of constant flux for most of that time, it may not fully reflect current thinking. https://mail.mozilla.org/pipermail/rust-dev/2013-January/002903.html https://mail.mozilla.org/pipermail/rust-dev/2013-January/002...
- erickt 12y agoYears ago we had pure functions that have since been replaced with our current function model. I'm betting that we are still reserving "pure" from that time. I haven't heard of anyone proposing to use it for something, so should probably unreserve it.