[rust-dev] Purity by default

Jesse Ruderman jruderman at gmail.com
Tue Oct 23 20:49:31 PDT 2012

Should functions default to pure?

* With http://smallcultfollowing.com/babysteps/blog/2012/10/12/extending-the-definition-of-purity-in-rust/
I think most functions will be able to be pure.

* Would avoid the problem of forgetting to mark a function as pure,
causing pain for a caller.  (Or worse, causing the compiler to
generate slower code?)

* Would encourage writing pure code, by making pure less typing than impure.

* With http://smallcultfollowing.com/babysteps/blog/2012/10/23/function-and-object-types/
the "impure" and "unsafe" modifiers would move in the same direction.
(Currently, "pure" and "unsafe" move in opposite directions from the
default, which is impure.)

More information about the Rust-dev mailing list