Published February 22, 2022 | Version v1
Conference paper Open

Open Closures: Disclosing lambda's inner monomaniac object!

  • 1. Université de Montréal


While folklore teaches us that closures and objects are two sides of the same coin, they remain quite different in practice, most notably because closures are opaque, the only supported operation being to call them.

In this article we discuss a few cases where we need functions to be less opaque, and propose to satisfy this need by extending our beloved λ so as to expose as sorts of record fields some of the variables it captures. These open closures are close relatives of CLOS's funcallable objects as well as of the function objects of traditional object-oriented languages like Java, except that they are functions made to behave like objects rather than the reverse.

We present the design and implementation of such a feature in the context of Emacs Lisp.



Files (542.8 kB)

Name Size Download all
542.8 kB Preview Download

Additional details