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

使用类型化洞的实时函数式编程

Live Functional Programming with Typed Holes

Cyrus Omar, Ian Voysey, Ravi Chugh, Matthew A. Hammer

摘要:

本文开发了一个动态语义不完整的功能程序,从静态语义在最近的工作榛子。我们将不完整的函数程序建模为带孔的表达式,空的孔代表缺失的表达式或类型,非空的孔作为静态和动态类型不一致的膜。而不是像在一些现有系统中那样在评估遇到任何这些孔时中止,评估围绕孔进行,当它流过程序的其余部分时跟踪每个孔实例周围的闭合。编辑器服务可以使用这些漏洞闭合中的信息来帮助程序员在决定如何填充剩余的漏洞时开发和确认程序的完整部分的行为的心理模型。孔洞闭合还支持填充并恢复操作,从而避免了在相当于孔洞填充的编辑之后重新开始计算的需要。从形式上讲,语义学借用了渐进类型论(为处理未填充的类型漏洞提供了基础)和上下文模态类型论(为漏洞闭包提供了逻辑基础)的机制,将这些机制结合起来,并开发了必要的额外机制来继续评估过去的漏洞,同时保持类型安全。我们已经使用Agda证明助手将核心演算的元理论机械化,称为Hazelnut Live。我们还将这些想法实现到Hazel编程环境中。该实现遵循Hazelnut编辑操作演算自动插入漏洞,以保证每个编辑器状态都有一些(可能不完整)类型。结合本文的类型安全属性,其结果是一个概念验证的实时编程环境,其中丰富的动态反馈是真正可用的,没有差距,即每一个可达的编辑器状态。

英文摘要:

This paper develops a dynamic semantics for incomplete functional programs, starting from the static semantics developed in recent work on Hazelnut. We model incomplete functional programs as expressions with holes, with empty holes standing for missing expressions or types, and non-empty holes operating as membranes around static and dynamic type inconsistencies. Rather than aborting when evaluation encounters any of these holes as in some existing systems, evaluation proceeds around holes, tracking the closure around each hole instance as it flows through the remainder of the program. Editor services can use the information in these hole closures to help the programmer develop and confirm their mental model of the behavior of the complete portions of the program as they decide how to fill the remaining holes. Hole closures also enable a fill-and-resume operation that avoids the need to restart evaluation after edits that amount to hole filling. Formally, the semantics borrows machinery from both gradual type theory (which supplies the basis for handling unfilled type holes) and contextual modal type theory (which supplies a logical basis for hole closures), combining these and developing additional machinery necessary to continue evaluation past holes while maintaining type safety. We have mechanized the metatheory of the core calculus, called Hazelnut Live, using the Agda proof assistant. We have also implemented these ideas into the Hazel programming environment. The implementation inserts holes automatically, following the Hazelnut edit action calculus, to guarantee that every editor state has some (possibly incomplete) type. Taken together with this paper's type safety property, the result is a proof-of-concept live programming environment where rich dynamic feedback is truly available without gaps, i.e. for every reachable editor state.

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

↑