On Tue, Apr 30, 2013 at 10:08 AM, Max Cantor <[email protected]> wrote: > I know this will be an unpopular opinion, but pure functions would be a > massive win for Rust, especially if the eventual goal is high performance, > highly parallelizable (browser rendering engines..) development.
Being able to annotate a function as side-effect free (e.g. via __attribute__ ((pure)) in GCC) can yield some useful optimizations, but I expect that LTO largely makes it unnecessary. The pure attribute in GCC in C is not checked and can result in bugs, but I think it's also not widely enough used in C that there is a lot of practical experience with bugs resulting from the misuse. At times I know I've wished the annotation were more widely used just because it would make reasoning about third party code easier: "does foobar() have non-trivial side effects???" I understand that D has checkable pure functions I'm not sure how useful they've been there. I recall hearing that there were some gnarly interactions with heap allocation. _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
