逐步分型以实现可扩展性
Gradual Typing for Extensibility by Rows
摘要:
这项工作研究了行类型和行多态性的逐步类型化。这项工作中的关键要素是动态行类型,它表示行的静态未知部分,以及行类型的一致性,它允许将静态行类型注入动态行类型,反之,将动态行类型投影到任何静态行类型。虽然一致性静态地捕获动态行类型的行为,但当与标识行类型直到字段重新排序的行等价相结合时,它使逐渐类型化语言的语义不一致。为了解决这个问题,我们开发了一致等价,它的特点是一致性和行等价的组合。使用一致等价,我们提出了一个多态归咎演算行类型和行多态性。在我们的责备演算中,强制转换不仅执行动态行类型的运行时检查,而且还执行行类型中的字段重新排序。为了简化行多态性的技术开发,我们采用了作用域标签,这是Koka语言所采用的,也是在效果系统的上下文中出现的。利用这些技术发展给出了我们的责备演算的形式化定义,并证明了它的类型可靠性。我们还勾画了逐渐类型化的表面语言和类型保持翻译的表面语言的责任演算和讨论的保守性的表面语言的静态类型化的语言与行类型和行多态性。
英文摘要:
This work studies gradual typing for row types and row polymorphism. Key ingredients in this work are the dynamic row type, which represents a statically unknown part of a row, and consistency for row types, which allows injecting static row types into the dynamic row type and, conversely, projecting the dynamic row type to any static row type. While consistency captures the behavior of the dynamic row type statically, it makes the semantics of a gradually typed language incoherent when combined with row equivalence which identifies row types up to field reordering. To solve this problem, we develop consistent equivalence, which characterizes composition of consistency and row equivalence. Using consistent equivalence, we propose a polymorphic blame calculus for row types and row polymorphism. In our blame calculus, casts perform not only run-time checking with the dynamic row type but also field reordering in row types. To simplify our technical development for row polymorphism, we adopt scoped labels, which are employed by the language Koka and are also emerging in the context of effect systems. We give the formal definition of our blame calculus with these technical developments and prove its type soundness. We also sketch the gradually typed surface language and type-preserving translation from the surface language to the blame calculus and discuss conservativity of the surface language over typing of a statically typed language with row types and row polymorphism.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。