Abstracting Gradual Typing

被引:0
作者
Garcia R. [1 ]
Clark A.M. [1 ]
Tanter E. [2 ]
机构
[1] Software Practices Lab., Department of Computer Science, University of British Columbia
[2] PLEIAD Laboratory, Computer Science Department (DCC), University of Chile
来源
ACM SIGPLAN Notices | 2016年 / 51卷 / 01期
基金
加拿大自然科学与工程研究理事会;
关键词
Abstract interpretation; Gradual typing; Subtyping;
D O I
10.1145/2837614.2837670
中图分类号
学科分类号
摘要
Language researchers and designers have extended a wide variety of type systems to support gradual typing, which enables languages to seamlessly combine dynamic and static checking. These efforts consistently demonstrate that designing a satisfactory gradual counterpart to a static type system is challenging, and this challenge only increases with the sophistication of the type system. Gradual type system designers need more formal tools to help them conceptualize, structure, and evaluate their designs. In this paper, we propose a new formal foundation for gradual typing, drawing on principles from abstract interpretation to give gradual types a semantics in terms of pre-existing static types. Abstracting Gradual Typing (AGT for short) yields a formal account of consistency-one of the cornerstones of the gradual typing approach-that subsumes existing notions of consistency, which were developed through intuition and ad hoc reasoning. Given a syntax-directed static typing judgment, the AGT approach induces a corresponding gradual typing judgment. Then the type safety proof for the underlying static discipline induces a dynamic semantics for gradual programs defined over sourcelanguage typing derivations. The AGT approach does not resort to an externally justified cast calculus: instead, run-time checks naturally arise by deducing evidence for consistent judgments during proof reduction. To illustrate the approach, we develop a novel gradually-typed counterpart for a language with record subtyping. Gradual languages designed with the AGT approach satisfy by construction the refined criteria for gradual typing set forth by Siek and colleagues. © 2016 ACM.
引用
收藏
页码:429 / 442
页数:13
相关论文
共 38 条
  • [1] Ahmed A., Findler R.B., Siek J., Wadler P., Blame for all, 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2011), pp. 201-214, (2011)
  • [2] Anderson C., Drossopoulou S., BabyJ: From object based to class based programming via types, Electronic Notes in Theoretical Computer Science, 82, 8, (2003)
  • [3] Banados Schwerter F., Garcia R., Tanter E., A theory of gradual effect systems, 19th ACM SIGPLAN Conference on Functional Programming (ICFP 2014), pp. 283-295, (2014)
  • [4] Church A., A formulation of the simple theory of types, J. Symbolic Logic, 5, 2, pp. 56-68, (1940)
  • [5] Cimini M., Siek J.G., The gradualizer: A methodology and algorithm for generating gradual type systems, 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016), (2016)
  • [6] Cousot P., Cousot R., Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints, 4th ACM Symposium on Principles of Programming Languages (POPL 77), pp. 238-252, (1977)
  • [7] Cousot P., Cousot R., Higher-order abstract interpretation (and application to comportment analysis generalizing strictness, termination, projection and per analysis of functional languages), invited paper 1994, International Conference on Computer Languages, pp. 95-112, (1994)
  • [8] Disney T., Flanagan C., Gradual information flow typing, International Workshop on Scripts to Programs, (2011)
  • [9] Fennell L., Thiemann P., Gradual security typing with references, Computer Security Foundations Symposium, pp. 224-239, (2013)
  • [10] Findler R.B., Felleisen M., Contracts for higher-order functions, 7th ACM SIGPLAN Conference on Functional Programming (ICFP 2002), pp. 48-59, (2002)