详细说明交集和并集类型
Elaborating Intersection and Union Types
摘要:
设计和实现类型化的程序设计语言是困难的。每一个新的类型系统功能都需要扩展元理论和实现,这通常是复杂和脆弱的。为了简化这个过程,我们希望提供一个通用的机制来支持许多不同的特性。在现代类型系统中,参数多态性是基本的,但是交集多态性在程序设计语言中几乎没有得到重视。大多数实际的交集类型系统只支持细化交集,这增加了类型的表达能力(可以检查更精确的属性),而不会改变术语的表达能力;细化交集可以在编译期间简单地删除。相比之下,不受限制的交集增加了术语的表达能力,并且可以用于编码不同的语言特征,从而有望实现理论和实现的经济性。我们描述了一个基础编译无限制的交集和联合类型:一个精心制作的类型系统,产生普通的微积分术语。关键特性是一个类似Forsythe的合并构造。有了这个结构,并不是所有的减少的源程序保留类型,但是,我们证明了普通的调用值评估的精心策划的程序对应的类型保持评价的源程序。我们还描述了一个原型实现和应用程序的无限制的交集和工会:记录,运算符重载,并模拟动态类型。
英文摘要:
Designing and implementing typed programming languages is hard. Every new type system feature requires extending the metatheory and implementation, which are often complicated and fragile. To ease this process, we would like to provide general mechanisms that subsume many different features. In modern type systems, parametric polymorphism is fundamental, but intersection polymorphism has gained little traction in programming languages. Most practical intersection type systems have supported only refinement intersections, which increase the expressiveness of types (more precise properties can be checked) without altering the expressiveness of terms; refinement intersections can simply be erased during compilation. In contrast, unrestricted intersections increase the expressiveness of terms, and can be used to encode diverse language features, promising an economy of both theory and implementation. We describe a foundation for compiling unrestricted intersection and union types: an elaboration type system that generates ordinary lambda-calculus terms. The key feature is a Forsythe-like merge construct. With this construct, not all reductions of the source program preserve types; however, we prove that ordinary call-by-value evaluation of the elaborated program corresponds to a type-preserving evaluation of the source program. We also describe a prototype implementation and applications of unrestricted intersections and unions: records, operator overloading, and simulating dynamic typing.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。