Effects for Funargs
Jeremy G. Siek, Michael M. Vitousek, Jonathan D. Turner

TL;DR
This paper introduces a type and effect system that safely combines stack allocation with first-class functions, addressing safety, efficiency, and simplicity in language design.
Contribution
It presents a novel design integrating type and effect systems with function-local storage to improve safety and efficiency without sacrificing simplicity.
Findings
Ensures safety by preventing functions from outliving referenced variables.
Balances safety, efficiency, and simplicity in language features.
Provides a practical approach applicable to multiple programming languages.
Abstract
Stack allocation and first-class functions don't naturally mix together. In this paper we show that a type and effect system can be the detergent that helps these features form a nice emulsion. Our interest in this problem comes from our work on the Chapel language, but this problem is also relevant to lambda expressions in C++ and blocks in Objective C. The difficulty in mixing first-class functions and stack allocation is a tension between safety, efficiency, and simplicity. To preserve safety, one must worry about functions outliving the variables they reference: the classic upward funarg problem. There are systems which regain safety but lose programmer-predictable efficiency, and ones that provide both safety and efficiency, but give up simplicity by exposing regions to the programmer. In this paper we present a simple design that combines a type and effect system, for safety, with…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Formal Methods in Verification · Security and Verification in Computing
