Papaya:别名对象的全局类型状态分析扩展版
Papaya: Global Typestate Analysis of Aliased Objects Extended Version
摘要:
类型状态是面向对象编程中使用的状态机,用于指定和验证对象上方法调用的正确顺序。为了避免不一致的对象状态,类型状态强制线性类型化,这消除了--或者最多是限制了--别名。然而,别名是编程中的一个重要特性,如果我们希望在真实世界的软件系统中采用类型状态,那么现有的类型状态限制太多。在本文中,我们提出了一个面向对象的语言类型系统与typestate注释,它允许不受限制的别名,而不是以前的方法,它不需要线性约束。类型状态分析是全局的,它跟踪整个程序图中的对象,这确保了良好类型的程序符合并完成声明的协议。我们实现了我们的框架在Scala程序设计语言,并说明我们的方法使用一个运行的例子,显示类型状态和别名之间的相互作用。
英文摘要:
Typestates are state machines used in object-oriented programming to specify and verify correct order of method calls on an object. To avoid inconsistent object states, typestates enforce linear typing, which eliminates - or at best limits - aliasing. However, aliasing is an important feature in programming, and the state-of-the-art on typestates is too restrictive if we want typestates to be adopted in real-world software systems. In this paper, we present a type system for an object-oriented language with typestate annotations, which allows for unrestricted aliasing, and as opposed to previous approaches it does not require linearity constraints. The typestate analysis is global and tracks objects throughout the entire program graph, which ensures that well-typed programs conform and complete the declared protocols. We implement our framework in the Scala programming language and illustrate our approach using a running example that shows the interplay between typestates and aliases.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。