Stretching the storage manager: weak pointers and stable names in Haskell
- Simon Peyton Jones ,
- Simon Marlow ,
- Conal Elliott
Proceedings of the 11th International Workshop on the Implementation of Functional Languages |
Published by Springer-Verlag
(Submitted to ICFP'99.)
Every now and then, a user of the Glasgow Haskell Compiler asks for a feature that requires specialised support from the storage manager. Memo functions, pointer equality, external pointers, finalizers, and weak pointers, are all examples. We take memo functions as our exemplar because they turn out to be the trickiest to support. We present no fewer than four distinct mechanisms that are needed to support memo tables, and that (in various combinations) satisfy a variety of other needs. The resulting set of primitives is undoubtedly powerful and useful. Whether they are too powerful is not yet clear. While the focus of our discussion is on Haskell, there is nothing Haskell-specific about most of the primitives, which could readily be used in other settings.
Errata: In Figure 3, the function not_found should have a formal parameter sn, and the call to not_found (four lines above its definition) should pass sn as an argument.