Abstract
A number of important program rewriting scenarios can be recast as type-directed coercion insertion. These range from more theoretical applications such as coercive subtyping and supporting overloading in type theories, to more practical applications such as integrating static and dynamically typed code using gradual typing, and inlining code to enforce security policies such as access control and provenance tracking. In this paper we give a general theory of type-directed coercion insertion. We specifically explore the inherent tradeoff between expressiveness and ambiguity--the more powerful the strategy for generating coercions, the greater the possibility of several, semantically distinct rewritings for a given program. We consider increasingly powerful coercion generation strategies, work out example applications supported by the increased power (including those mentioned above), and identify the inherent ambiguity problems of each setting, along with various techniques to tame the ambiguities.
Supplemental Material
- P. Aczel. A notion of class for type theory, 1995. Unpublished manuscript.Google Scholar
- G. Barthe. Implicit coercions in type theories. In Proc. of Types workshop, 1996. Google Scholar
Digital Library
- V. Breazu-Tannen, T. Coquand, C. Gunter, and A. Scedrov. Inheritance as implicit coercion. Information and Computation, 93: 172--221, 1991. Google Scholar
Digital Library
- J. Cheney, A. Ahmed, and U. A. Acar. Provenance as dependency analysis. In Proc. of DBPL, 2007. Google Scholar
Digital Library
- C. Flanagan. Hybrid type checking. In Proc. of POPL, 2006. Google Scholar
Digital Library
- V. Ganapathy, T. Jaeger, and S. Jha. Retrofitting legacy code for authorization policy enforcement. Proc. of Security and Privacy, 2006. Google Scholar
Digital Library
- F. Henglein. Dynamic typing: syntax and proof theory. Science of Computer Programming, 22: 197--230, 1994. Google Scholar
Digital Library
- S. Lindley, P. Wadler, and J. Yallop. Idioms are oblivious, arrows are meticulous, monads are promiscuous. In Proc. of MSFP, 2008.Google Scholar
- Z. Luo. Coercions in a polymorphic type system. Mathematical Structures in Computer Science, 18 (4): 729--751, 2008. Google Scholar
Digital Library
- Z. Luo. Coercive subtyping in type theory. In Proc. of CSL, 1996. Google Scholar
Digital Library
- Z. Luo. Coercive subtyping. Journal of Logic and Computation, 9 (1): 105--130, 1999.Google Scholar
Cross Ref
- Z. Luo and R. Kießling. Coercions in Hindley-Milner systems. In Proc. of Types, 2004.Google Scholar
- Z. Luo and Y. Luo. Transitivity in coercive subtyping. Information and Computation, 197 (1-2): 122--144, 2005.Google Scholar
Digital Library
- P. Pratikakis, J. Spacco, and M. Hicks. Transparent proxies for Java futures. In Proc. of OOPSLA, 2004. Google Scholar
Digital Library
- A. Sabelfeld and A. C. Myers. Language--based information-flow security. JSAC, 21 (1): 5--19, 2003. Google Scholar
Digital Library
- A. Saıbi. Typing algorithm in type theory with inheritance. In Proc. of POPL, 1997. Google Scholar
Digital Library
- J. G. Siek and W. Taha. Gradual typing for functional languages. In Proc. of Scheme and Functional Programming Workshop, 2006.Google Scholar
- J. G. Siek, R. Garcia, and W. Taha. Exploring the design space of higher-order casts. In Proc. of ESOP, 2009. Google Scholar
Digital Library
- G. Stoyle, M. Hicks, G. Bierman, P. Sewell, and I. Neamtiu. Mutatis Mutandis: Safe and flexible dynamic software updating. ACM TOPLAS, 29 (4), 2007. Google Scholar
Digital Library
- M. Sulzmann, M. M. T. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In Proc. of TLDI, 2007. Google Scholar
Digital Library
- N. Swamy, B. J. Corcoran, and M. Hicks. Fable: A language for enforcing user-defined security policies. In Proc. of Security and Privacy, 2008. Google Scholar
Digital Library
- N. Swamy, M. Hicks, and G. Bierman. A theory of typed coercions and its applications. Technical Report MSR-TR-2009-69, Microsoft Research, 2009.Google Scholar
Digital Library
- P. Wadler and R. B. Findler. Well-typed programs can't be blamed. In Proc. of ESOP, 2009. Google Scholar
Digital Library
Index Terms
A theory of typed coercions and its applications
Recommendations
A theory of typed coercions and its applications
ICFP '09: Proceedings of the 14th ACM SIGPLAN international conference on Functional programmingA number of important program rewriting scenarios can be recast as type-directed coercion insertion. These range from more theoretical applications such as coercive subtyping and supporting overloading in type theories, to more practical applications ...
Interpretations of the gradually-typed lambda calculus
Scheme '12: Proceedings of the 2012 Annual Workshop on Scheme and Functional ProgrammingGradual typing is an approach to integrating static and dynamic type checking within the same language [Siek and Taha 2006]. Given the name "gradual typing", one might think that the most interesting aspect is the type system. It turns out that the ...
Toward efficient gradual typing for structural types via coercions
PLDI 2019: Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and ImplementationGradual typing combines static and dynamic typing in the same program. Siek et al. (2015) describe five criteria for gradually typed languages, including type soundness and the gradual guarantee. A significant number of languages have been developed in ...









Comments