ABSTRACT
We motivate and discuss a novel functional programming construct that allows convenient modular run-time nonstandard interpretation via reflection on closure environments. This map-closure construct encompasses both the ability to examine the contents of a closure environment and to construct a new closure with a modified environment. From the user's perspective, map-closure is a powerful and useful construct that supports such tasks as tracing, security logging, sandboxing, error checking, profiling, code instrumentation and metering, run-time code patching, and resource monitoring. From the implementor's perspective, map-closure is analogous to call/cc. Just as call/cc is a non-referentially-transparent mechanism that reifies the continuations that are only implicit in programs written in direct style, map-closure is a non-referentially-transparent mechanism that reifies the closure environments that are only implicit in higher-order programs. Just as CPS conversion is a non-local but purely syntactic transformation that can eliminate references to call/cc, closure conversion is a non-local but purely syntactic transformation that can eliminate references to map-closure. We show how the combination of map-closure and call/cc can be used to implement set! as a procedure definition and a local macro transformation.
- W. Clinger, D. P. Friedman, and M. Wand, "A scheme for a higher-level semantic algebra," in Algebraic Methods in Semantics, J. Reynolds and M. Nivat, Eds. Cambridge University Press, 1985, pp. 237--250. Google Scholar
Digital Library
- R. E. Wengert, "A simple automatic derivative evaluation program," Comm. of the ACM, vol. 7, no. 8, pp. 463--4, 1964. Google Scholar
Digital Library
- W. K. Clifford, "Preliminary sketch of bi-quaternions," Proceedings of the London Mathematical Society, vol. 4, pp. 381--395, 1873.Google Scholar
Cross Ref
- J. C. Reynolds, "Definitional interpreters for higher-order programming languages," in Proceedings of the 25th ACM National Conference, 1972, reprinted in Higher Order and Symbolic Computing, 11(4):363--397, 1998. Google Scholar
Digital Library
- G. L. Steele, Jr. and G. J. Sussman, "Lambda, the ultimate imperative," MIT Artificial Intelligence Laboratory, A. I. Memo 353, Mar. 1976. Google Scholar
Digital Library
- T. Johnsson, "Lambda lifting: Transforming programs to recursive equations," in Functional Programming Languages and Computer Architecture. Nancy, France: Springer-Verlag, Sept. 1985. Google Scholar
Digital Library
- W. Clinger and J. Rees, Revised4 Report on the Algorithmic Language Scheme, Nov. 1991.Google Scholar
- D. MacQueen, "Modules for Standard ML," in Proceedings of the 1984 ACM Symposium on LISP and Functional Programming, Austin, TX, 1984, pp. 198--207. Google Scholar
Digital Library
- G. Kiczales, J. Lamping, A. Menhdhekar, C. Maeda, C. Lopes, J.-M. Loingtier, and J. Irwin, "Aspect-oriented programming," in Proceedings of the European Conference on Object-Oriented Programming, 1997, pp. 220--242.Google Scholar
- J. McCarthy, "A basis for a mathematical theory of computation," in Computer Programing and Formal Systems, P. Braffort and D. Hirschberg, Eds.Amsterdam: Elsevier North-Holland, 1963.Google Scholar
- J. M. Siskind and D. A. McAllester, "Screamer: A portable efficient implementation of nondeterministic CommonLisp," University of Pennsylvania Institute for Research in Cognitive Science, tech. report IRCS-93-03, 1993.Google Scholar
- ------, "Nondeterministic Lisp as a substrate for constraint logic programming," in Proceedings of the Eleventh National Conference on Artificial Intelligence, July 1993, pp. 133--8.Google Scholar
Index Terms
First-class nonstandard interpretations by opening closures
Recommendations
First-class nonstandard interpretations by opening closures
Proceedings of the 2007 POPL ConferenceWe motivate and discuss a novel functional programming construct that allows convenient modular run-time nonstandard interpretation via reflection on closure environments. This map-closure construct encompasses both the ability to examine the contents ...
Capsules and Closures
Capsules are a clean representation of the state of a computation in higher-order programming languages with effects. Their intent is to simplify and replace the notion of closure. They naturally provide support for functional and imperative features, ...
An Approach to Computing Downward Closures
ICALP 2015: Proceedings, Part II, of the 42nd International Colloquium on Automata, Languages, and Programming - Volume 9135The downward closure of a word language is the set of all not necessarily contiguous subwords of its members. It is well-known that the downward closure of any language is regular. While the downward closure appears to be a powerful abstraction, ...






Comments