Threads like "Why D const is annoying" show that there is desire for logical immutability, for pure memoization, etc. I'd like the memoization of a pure function to be pure still.

This is a closely related group of problems (including "pointer equality, external pointers, finalizers, and weak pointers") surely present in functional languages too, so (with a bit of help from a person of the "Lambda The Ultimate" blog) I have found two papers that show some ideas and solutions.

"Stretching the storage manager: weak pointers and stable names in Haskell" (1999), by Simon Peyton Jones, Simon Marlow, and Conal Elliot:
http://community.haskell.org/~simonmar/papers/weak.pdf
http://research.microsoft.com/apps/pubs/default.aspx?id=67497

"Observable sharing for functional circuit description" (1999), by Koen Claessen, David Sands (this looks less related, but the authors face the same class of problems):
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.4053

Probably there are other papers on this topic, with solutions that don't require breaking purity or immutability in user code.

Bye,
bearophile

Reply via email to