On 2010-09-21 22:21:39 -0400, Don <nos...@nospam.com> said:

PROPOSAL:
Drop the first requirement. Only one requirement is necessary:

A pure function does not read or write any global mutable state.

If a pure function has parameters that are all immutable or are implicitly convertible to immutable, then the compiler is permitted to cache the results.

This is what I was advocating a long time ago when pure came out.

The current rule prevent you from doing any serious work from inside a pure function. Inside a pure function you can only call a pure function, you can't even call functions that take mutable references to local variables. This makes it impossible to use generic algorithms, such as sort, to manipulate local mutable data, even when those algorithms have no need for a global state.

So I certainly support this change.

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

Reply via email to