论文标题
逐渐健全:静态python的课程
Gradual Soundness: Lessons from Static Python
论文作者
论文摘要
上下文:逐渐使用的语言允许键入和未经类型的代码互操作,但通常具有重要的缺点。在某些语言中,类型是不可靠的。在其他情况下,跨类型边界的通信可能非常昂贵。还有其他人仅允许有限的互操作性。研究界正在积极寻求一种逐渐键入的声音,快速和表现力的方法。 询问:本文描述了静态python,这是由Instagram工程师开发的一种语言,在生产中证明了自己的声音,快速和合理的表现力。静态Python的逐渐类型方法本质上是文献中混凝土和瞬态方法的程序员可调组合。混凝土类型可提供全面的声音和低性能的开销,但施加了非本地限制。瞬态类型在浅薄的意义上是合理的,易于使用;它们有助于弥合未经类似的代码和键入混凝土代码之间的差距。 方法:我们在当前状态下评估语言,并开发出一种捕获其逐渐类型方法的本质的模型。我们利用个人通信,错误报告和静态Python回归测试套件来开发此模型。 知识:我们的主要发现是,由混凝土和瞬态类型的混合产生的逐渐声音是降低混凝土方法维护成本的有效方法。我们还发现,基于方法的JIT技术可以消除瞬态方法的成本。从技术层面上讲,本文介绍了两个贡献:静态python的模型和静态python的性能评估。形式化的过程发现实施中有几个错误,包括致命错误。 接地:我们的静态Python模型在PLT Redex中实现,并使用基于属性的声音测试和265次测试进行了测试。本文包括模型的一小部分,以传达静态Python方法及其健全性的主要思想。我们的性能主张基于Instagram Web服务器中的生产经验。服务器中的静态python迁移已在最大CPU负载下每秒处理的请求增加了3.7%。 重要性:静态python是第一个声音渐进的语言,其在现实代码库中的作品将其应用始终提高了性能。其他语言设计师可能希望复制其方法,尤其是那些目前保持不健全的渐进语言并正在寻求合理途径的方法。
Context: Gradually-typed languages allow typed and untyped code to interoperate, but typically come with significant drawbacks. In some languages, the types are unreliable; in others, communication across type boundaries can be extremely expensive; and still others allow only limited forms of interoperability. The research community is actively seeking a sound, fast, and expressive approach to gradual typing. Inquiry: This paper describes Static Python, a language developed by engineers at Instagram that has proven itself sound, fast, and reasonably expressive in production. Static Python's approach to gradual types is essentially a programmer-tunable combination of the concrete and transient approaches from the literature. Concrete types provide full soundness and low performance overhead, but impose nonlocal constraints. Transient types are sound in a shallow sense and easier to use; they help to bridge the gap between untyped code and typed concrete code. Approach: We evaluate the language in its current state and develop a model that captures the essence of its approach to gradual types. We draw upon personal communication, bug reports, and the Static Python regression test suite to develop this model. Knowledge: Our main finding is that the gradual soundness that arises from a mix of concrete and transient types is an effective way to lower the maintenance cost of the concrete approach. We also find that method-based JIT technology can eliminate the costs of the transient approach. On a more technical level, this paper describes two contributions: a model of Static Python and a performance evaluation of Static Python. The process of formalization found several errors in the implementation, including fatal errors. Grounding: Our model of Static Python is implemented in PLT Redex and tested using property-based soundness tests and 265 tests from the Static Python regression suite. This paper includes a small core of the model to convey the main ideas of the Static Python approach and its soundness. Our performance claims are based on production experience in the Instagram web server. Migrations to Static Python in the server have caused a 3.7\% increase in requests handled per second at maximum CPU load. Importance: Static Python is the first sound gradual language whose piece-meal application to a realistic codebase has consistently improved performance. Other language designers may wish to replicate its approach, especially those who currently maintain unsound gradual languages and are seeking a path to soundness.