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

用静态类型解决Funarg问题

Solving the Funarg Problem with Static Types

Caleb Helbling, Fırat Aksoy

摘要:

与在基于堆栈的环境中存储闭包相关的困难称为funarg问题。funarg问题在20世纪70年代的Lisp开发中首次被发现,此后没有受到太多关注。大多数语言采用的现代解决方案是在堆上分配闭包,或者应用静态分析来确定何时可以对闭包进行堆栈分配。这对于大多数计算系统来说不是问题,因为有大量的内存。然而,嵌入式系统通常具有有限的存储器资源,其中堆分配可能导致存储器碎片。我们提出了一个简单的扩展系统F的prenex片段,允许闭包被堆栈分配。我们展示了一个具体的实现,这个系统的Juniper功能反应程序设计语言,这是专为运行在资源极其有限的Arduino设备。我们还讨论了其他程序设计语言中存在的解决funarg问题的其他解决方案,但这些解决方案尚未在文献中正式讨论。

英文摘要:

The difficulty associated with storing closures in a stack-based environment is known as the funarg problem. The funarg problem was first identified with the development of Lisp in the 1970s and hasn't received much attention since then. The modern solution taken by most languages is to allocate closures on the heap, or to apply static analysis to determine when closures can be stack allocated. This is not a problem for most computing systems as there is an abundance of memory. However, embedded systems often have limited memory resources where heap allocation may cause memory fragmentation. We present a simple extension to the prenex fragment of System F that allows closures to be stack-allocated. We demonstrate a concrete implementation of this system in the Juniper functional reactive programming language, which is designed to run on extremely resource limited Arduino devices. We also discuss other solutions present in other programming languages that solve the funarg problem but haven't been formally discussed in the literature.

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

↑