Is pure meant to be a compiler hint so that it is up to the programmer to enforce it? It is sometimes useful to maintain hidden state for lazy evaluation, that does not affect purity optimizations:

e.g.

a = foo(1) // evaluates, caches and returns value
b = foo(1) // returns cached value
c = foo (1) // returns cached value

is optimized to

a = b = c = foo(1) // evaluates, caches and returns value

Reply via email to