We present gradual type theory, a logic and type theory for call-by-name gradual typing. We define the central constructions of gradual typing (the dynamic type, type casts and type error) in a novel way, by universal properties relative to new judgments for gradual type and term dynamism, which were developed in blame calculi and to state the "gradual guarantee" theorem of gradual typing. Combined with the ordinary extensionality ($η$) principles that type theory provides, we show that most of the standard operational behavior of casts is uniquely determined by the gradual guarantee. This provides a semantic justification for the definitions of casts, and shows that non-standard definitions of casts must violate these principles. Our type theory is the internal language of a certain class of preorder categories called equipments. We give a general construction of an equipment interpreting gradual type theory from a 2-category representing non-gradual types and programs, which is a semantic analogue of Findler and Felleisen's definitions of contracts, and use it to build some concrete domain-theoretic models of gradual typing.
Space-Efficient Gradual Typing in Coercion-Passing Style
Herman等人指出,在渐进类型化程序中插入运行时检查可能会妨碍尾部调用优化,从而恶化程序的空间复杂度。为了解决这个问题,他们提出了一个空间有效的强制演算,随后由Siek等人改进。这些演算的语义涉及到由随机数表示的运行时检查的渴望组合,以防止术语的大小增长。然而,它还依赖于一个非标准的归约规则,这似乎不容易实现。事实上,没有渐进类型语言的编译器实现完全忠实地支持空间有效的语义。在本文中,我们研究了Herman等人已经提到过的子传递风格,作为一种简单的空间有效实现渐进类型语言的技术。一个程序在继承传递风格传递“其余的运行时检查”-就像延续传递风格(CPS),其中“其余的计算”被传递-和(不像CPS)组成继承急切。本文给出了Siek等人的$λ$ S到$λ$ S $_1$的形式化的传递函数转换,并证明了转换的正确性.我们还实现了我们的Grift编译器的Kuhlenschalet等人的实验结果表明,堆栈溢出可以适当地防止在大多数部分类型的实际程序的执行速度慢3倍的成本。
Mercem: Method Name Recommendation Based on Call Graph Embedding
Graduate School of System and Information Engineering, University of Tsukuba(筑波大学系统与信息工程研究生院);Faculty of Engineering, Information and Systems, University of Tsukuba(筑波大学工程、信息与系统学院);Center for Computational Sciences, University of Tsukuba(筑波大学计算科学中心)