arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1201.0023cs.PL
收藏

对Funargs的影响

Effects for Funargs

Jeremy G. Siek, Michael M. Vitousek, Jonathan D. Turner

摘要:

堆栈分配和一级函数不会自然地混合在一起。在本文中,我们表明,一种类型和效果系统可以是洗涤剂,帮助这些功能形成一个很好的乳液。我们对这个问题的兴趣来自于我们对Chapel语言的研究,但这个问题也与C++中的lambda表达式和Objective C中的块有关。混合使用一级函数和堆栈分配的困难在于安全性、效率和简单性之间的矛盾。为了保证安全性,必须担心函数的寿命超过它们引用的变量:经典的向上funarg问题。有些系统重新获得了安全性,但失去了程序员可预测的效率,有些系统既提供了安全性又提供了效率,但通过向程序员暴露区域而放弃了简单性。在本文中,我们提出了一个简单的设计,结合了类型和效果系统,安全,功能本地存储,控制效率。

英文摘要:

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 function-local storage, for control over efficiency.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑