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.
翻译:Errang 是一种功能性编程语言,具有动态打字功能。 语言为通过模式匹配和动态类型测试破坏值提供了极大的灵活性。 Errang 也使用一种类型语言支持参数多态、 等- 等- 等- 等- 类型, 以及组合和有限形式的交叉类型。 然而, 类型签名仅用作文档, 无法检查函数体符合其签名。 设置词性类型和语义亚型非常适合 Errang 的特性集。 它们允许表达几乎所有类型语言的构造, 并提供静态检查类型签名的手段。 文章将设置的理论类型带给 Errang, 并展示现有的 Erlan 代码如何不进行静态打印, 而不对代码稍作修改 。 此外, 文章将类型系统的主要成分正式化为小核心积分数, 报告系统实施情况, 并将它与 Erang 的其他静态类型检查器作比较 。</s>