arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2306.06391cs.PL
收藏

Elixir类型系统的设计原则

The Design Principles of the Elixir Type System

Giuseppe Castagna, Guillaume Duboc, José Valim

AI总结:

本文提出一个用于Elixir的渐进类型系统,基于集合论类型和语义子类型,扩展以处理函数元数、守卫等特性,旨在为Elixir社区引入静态类型并作为长期参考。

摘要:

Elixir是一种运行在Erlang虚拟机上的动态类型函数式语言,旨在构建可扩展且可维护的应用程序。其特性使其被数百家工业企业和数万名开发者迅速采用。如今,静态类型似乎是Elixir社区提出的最重要需求。我们提出了一个计划纳入Elixir编译器的渐进类型系统,概述了其特征和设计原则,并通过一些简短示例展示了如何在实际中使用它。\n开发一个适合Erlang语言家族的静态类型系统近二十年来一直是一个开放的研究问题。我们的系统将具有集合论类型和语义子类型的多态类型系统移植到这一语言家族中。为此,我们不得不改进和扩展语义子类型及其类型化技术,以考虑这些语言(尤其是Elixir)的若干特性,如函数的元数、守卫的使用、对记录和字典的统一处理,以及一种新的健全的渐进类型化纪律的需求,该纪律不依赖于在编译时插入特定的运行时类型测试,而是同时考虑虚拟机执行的类型测试和程序员显式添加的类型测试。\n这里介绍的系统正在“逐步”实现并集成到Elixir中,但原型实现已经可用。\n这项工作的目的是作为一份长期参考,用于向Elixir程序员介绍类型,并暗示Elixir语言未来的一些方向和可能的演变。

英文摘要:

Elixir is a dynamically-typed functional language running on the Erlang Virtual Machine, designed for building scalable and maintainable applications. Its characteristics have earned it a surging adoption by hundreds of industrial actors and tens of thousands of developers. Static typing seems nowadays to be the most important request coming from the Elixir community. We present a gradual type system we plan to include in the Elixir compiler, outline its characteristics and design principles, and show by some short examples how to use it in practice. Developing a static type system suitable for Erlang's family of languages has been an open research problem for almost two decades. Our system transposes to this family of languages a polymorphic type system with set-theoretic types and semantic subtyping. To do that, we had to improve and extend both semantic subtyping and the typing techniques thereof, to account for several characteristics of these languages -- and of Elixir in particular -- such as the arity of functions, the use of guards, a uniform treatment of records and dictionaries, the need for a new sound gradual typing discipline that does not rely on the insertion at compile time of specific run-time type-tests but, rather, takes into account both the type tests performed by the virtual machine and those explicitly added by the programmer. The system presented here is "gradually" being implemented and integrated in Elixir, but a prototype implementation is already available. The aim of this work is to serve as a longstanding reference that will be used to introduce types to Elixir programmers, as well as to hint at some future directions and possible evolutions of the Elixir language.

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

↑