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.
翻译:与在堆叠环境中储存封闭装置有关的困难被称为“ 拖拉机问题 ” 。 拖拉机问题最初与1970年代Lisp的开发有关,此后一直没有引起多少注意。 多数语言的现代解决办法是将关闭装置分配在堆肥上, 或采用静态分析来确定何时可以分配关闭装置。 这对大多数计算机系统来说并不是一个问题, 因为有丰富的记忆。 然而, 嵌入系统通常有有限的内存资源, 大量分配可能会造成记忆破碎。 我们为F系统前nex碎片提供了简单的扩展, 使关闭装置能够被堆叠。 我们用Juniper功能反应性编程语言演示了该系统的具体实施情况, 该语言的设计是利用极其有限的资源 Arduino 装置运行。 我们还讨论了其他编程语言中存在的其他解决方案,这些语言解决了真菌问题,但在文献中尚未正式讨论过。