面向Erlang的集合论类型
Set-theoretic Types for Erlang
AI总结:
针对Erlang现有类型签名仅作文档、无静态校验的问题,本文将适配其特性的集合论类型与语义子类型引入Erlang,实现少量修改即可静态检查现有代码,还形式化了类型系统核心并对比了其他检查器。
摘要:
Erlang是一门采用动态类型的函数式编程语言,该语言通过模式匹配与动态类型测试,为值的解构提供了极高的灵活性。Erlang还配套有一套类型语言,支持参数多态、等递归类型,以及联合类型和受限形式的交集类型。但目前类型签名仅作为文档使用,并无机制检查函数体是否符合其签名。\n集合论类型与语义子类型非常适配Erlang的特性集,它们几乎可以表达Erlang类型语言的所有构造,还能为类型签名的静态检查提供支撑。本文将集合论类型引入Erlang,论证了现有Erlang代码无需修改或仅需少量修改即可完成静态类型检查。此外,本文在一个小型核心演算中形式化了该类型系统的核心组成部分,报告了该系统的实现情况,并将其与其他Erlang静态类型检查器进行了对比。
英文摘要:
Erlang is a functional programming language with dynamic typing. The language offers great flexibility for destructing values through pattern matching and dynamic type tests. Erlang also comes with a type language supporting parametric polymorphism, equi-recursive types, as well as union and a limited form of intersection types. However, type signatures only serve as documentation, there is no check that a function body conforms to its signature. Set-theoretic types and semantic subtyping fit Erlang's feature set very well. They allow expressing nearly all constructs of its type language and provide means for statically checking type signatures. This article brings set-theoretic types to Erlang and demonstrates how existing Erlang code can be statically typechecked without or with only minor modifications to the code. Further, the article formalizes the main ingredients of the type system in a small core calculus, reports on an implementation of the system, and compares it with other static typecheckers for Erlang.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。