On 2010-09-22 01:26:01 -0400, "Robert Jacques" <sandf...@jhu.edu> said:

So removing the concurrency safety from pure would greatly expand the number of pure functions, however, automatic parallelism would be lost.

Don clearly mentioned that this is not lost. Basically, for safe parallelism what you need is a function that has a) pure and b) no mutable reference parameter. Both are easily checkable at compile time, you'd just need to change your test for pure for a test that also checks the arguments.

The interesting thing with this change is that you can now call mutators functions on the local variables inside the pure function, because those can be made pure. You can't even iterate over a range inside a pure function without this!

        pure int test() {
                int result;
                auto r = iota(0, 10);
                while (!r.empty) {
                        result += r;
                        r.popFront(); // can't be pure by current rules!
                }
                return result;
        }

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to