Abstract
Unmarshalling primitives in statically typed language require, in order to preserve type safety, to dynamically verify the compatibility between the incoming values and the statically expected type. In the context of programming languages based on parametric polymorphism and uniform data representation, we propose a relation of compatibility between (unmarshalled) memory graphs and types. It is defined as constraints over nodes of the memory graph. Then, we propose an algorithm to check the compatibility between a memory graph and a type. It is described as a constraint solver based on a rewriting system. We have shown that the proposed algorithm is sound and semi-complete in presence of algebraic data types, mutable data, polymorphic sharing, cycles, and functional values, however, in its general form, it may not terminate. We have implemented a prototype tailored for the OCaml compiler [17] that always terminates and still seems sufficiently complete in practice.
- M. Abadi, L. Cardelli, B. C. Pierce, and D. Rémy. Dynamic typing in polymorphic languages. Journal of Functional Programming, 5 (1): 111--130, Jan. 1995.Google Scholar
Cross Ref
- S. Aditya and A. Caro. Compiler-directed type reconstruction for polymorphic languages. In FPCA '93: Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pages 74--82, June 1993. Google Scholar
Digital Library
- S. Aditya, C. H. Flood, and J. E. Hicks. Garbage collection for strongly-typed languages using run-time type reconstruction. In LFP '94: Proceedings of the 1994 ACM Conference on LISP and Functional ProgrammingcitetLFP:94, pages 12--23. Google Scholar
Digital Library
- A. W. Appel. Runtime tags aren't necessary. Lisp and Symbolic Computation, 2 (2): 153--162, July 1989.Google Scholar
Cross Ref
- J. Billings, P. Sewell, M. R. Shinwell, and R. Strnisa. Type-safe distributed programming for OCaml. In ML'06: Proceedings of the ACM Workshop on ML, pages 20--31, Sept. 2006. Google Scholar
Digital Library
- K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type-erasure semantics. In ICFP'98: Proceedings of the 3rd ACM International Conference on Functional Programming, volume 34(1) of SIGPLAN Not., pages 301--312, Sept. 1998. Google Scholar
Digital Library
- M. Elsman. Type-specialized serialization with sharing. In TFP'05: Revised Selected Papers from the Sixth Symposium on Trends in Functional Programming, pages 47--62, Sept. 2005.Google Scholar
- R. B. Findler and M. Felleisen. Contracts for higher-order functions. In ICFP'02: Proceedings of the 7th ACM International Conference on Functional Programming, volume 37(9) of SIGPLAN Not., pages 48--59, Sept. 2002. Google Scholar
Digital Library
- J. Furuse and P. Weis. Input/output of caml values (in french). In JFLA'00: Journées Francophones des Langages Applicatifs. INRIA, Jan. 2000.Google Scholar
- B. Goldberg and M. Gloger. Polymorphic type reconstruction for garbage collection without tags. SIGPLAN Lisp Pointers, V (1): 53--65, 1992. Google Scholar
Digital Library
- G. Henry. Typing unmarshalling without marshalling types (in french). PhD thesis, Univ Paris Diderot, 2011. URL http://tel.archives-ouvertes.fr/tel-00624156/PDF/these.pdf.Google Scholar
- M. Hicks, S. Weirich, and K. Crary. Safe and flexible dynamic linking of native code. In R. Harper, editor, Workshop on Types in Compilation, volume 2071 of Lecture Notes in Computer Science, pages 147--176. Springer-Verlag, 2000. Google Scholar
Digital Library
- G. Huet. Résolution d'équations dans des langages d'ordre 1,2,..., ω. PhD thesis, Université Paris 7, 1976.Google Scholar
- A. J. Kennedy. Pickler combinators. Journal of Functional Programming, 14 (6): 727--739, 2004. Google Scholar
Digital Library
- X. Leroy. Efficient data representation in polymorphic languages. In PLILP'90: 2nd International Workshop on Programming Language Implementation and Logic Programming, volume 456 of Lecture Notes in Computer Science, pages 255--276. Springer, Aug. 1990. Google Scholar
Digital Library
- X. Leroy and M. Mauny. Dynamics in ML. Journal of Functional Programming, 3 (4): 431--463, 1993.Google Scholar
Cross Ref
- X. Leroy, D. Doligez, J. Garrigue, D. Rémy, and J. Vouillon. The Objective Caml system release 3.12, June 2010.Google Scholar
- A. Mycroft. Polymorphic type schemes and recursive definitions. In ISP'84: Proceedings of the 6th International Symposium on Programming, volume 167 of Lecture Notes in Computer Science, pages 217--228. Springer, 1984. Google Scholar
Digital Library
- G. Plotkin. A note on inductive generalization. Machine Intelligence, 5: 153--163, 1970.Google Scholar
- F. Pottier and D. Rémy. The Essence of ML Type Inference. In B. C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 10, pages 389--489. MIT Press, 2005.Google Scholar
- H. Sutou and E. Sumii. Quicksilver/OCaml: A poor man's type-safe and abstraction-secure communication library. Unpublished, 2007.Google Scholar
- S. Tobin-Hochstadt and M. Felleisen. The design and implementation of Typed Scheme. In POPL'08: Proceedings of the 35th ACM Symposium on Principles of Programming Languages, pages 395--406, Jan. 2008. Google Scholar
Digital Library
- A. P. Tolmach. Tag-free garbage collection using explicit type parameters. In LFP '94: Proceedings of the 1994 ACM Conference on LISP and Functional ProgrammingcitetLFP:94, pages 1--11. Google Scholar
Digital Library
- S. Weirich. Higher-order intensional type analysis. In ESOP'02: Proceedings of the 11th European Symposium on Programming, pages 98--114, 2002. Google Scholar
Digital Library
- S. Weirich. Type-safe run-time polytypic programming. Journal of Functional Programming, 16 (10): 681--710, Nov. 2006. Google Scholar
Digital Library
- J. Yallop. Practical generic programming in OCaml. In ML'07: Proceedings of the ACM Workshop on ML, pages 83--94, Sept. 2007. Google Scholar
Digital Library
Index Terms
Typing unmarshalling without marshalling types
Recommendations
Typing unmarshalling without marshalling types
ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programmingUnmarshalling primitives in statically typed language require, in order to preserve type safety, to dynamically verify the compatibility between the incoming values and the statically expected type. In the context of programming languages based on ...
Polymorphic type inference and abstract data types
Many statically typed programming languages provide an abstract data type construct, such as the module in Modula-2. However, in most of these languages, implementations of abstract data types are not first-class values. Thus, they cannot be assigned to ...







Comments