skip to main content
research-article

Typing unmarshalling without marshalling types

Authors Info & Claims
Published:09 September 2012Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarCross RefCross Ref
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. W. Appel. Runtime tags aren't necessary. Lisp and Symbolic Computation, 2 (2): 153--162, July 1989.Google ScholarGoogle ScholarCross RefCross Ref
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle Scholar
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle Scholar
  10. B. Goldberg and M. Gloger. Polymorphic type reconstruction for garbage collection without tags. SIGPLAN Lisp Pointers, V (1): 53--65, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle Scholar
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. Huet. Résolution d'équations dans des langages d'ordre 1,2,..., ω. PhD thesis, Université Paris 7, 1976.Google ScholarGoogle Scholar
  14. A. J. Kennedy. Pickler combinators. Journal of Functional Programming, 14 (6): 727--739, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. X. Leroy and M. Mauny. Dynamics in ML. Journal of Functional Programming, 3 (4): 431--463, 1993.Google ScholarGoogle ScholarCross RefCross Ref
  17. X. Leroy, D. Doligez, J. Garrigue, D. Rémy, and J. Vouillon. The Objective Caml system release 3.12, June 2010.Google ScholarGoogle Scholar
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. G. Plotkin. A note on inductive generalization. Machine Intelligence, 5: 153--163, 1970.Google ScholarGoogle Scholar
  20. 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 ScholarGoogle Scholar
  21. H. Sutou and E. Sumii. Quicksilver/OCaml: A poor man's type-safe and abstraction-secure communication library. Unpublished, 2007.Google ScholarGoogle Scholar
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. Weirich. Higher-order intensional type analysis. In ESOP'02: Proceedings of the 11th European Symposium on Programming, pages 98--114, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Weirich. Type-safe run-time polytypic programming. Journal of Functional Programming, 16 (10): 681--710, Nov. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. J. Yallop. Practical generic programming in OCaml. In ML'07: Proceedings of the ACM Workshop on ML, pages 83--94, Sept. 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Typing unmarshalling without marshalling types

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 47, Issue 9
      ICFP '12
      September 2012
      368 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2398856
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
        September 2012
        392 pages
        ISBN:9781450310543
        DOI:10.1145/2364527

      Copyright © 2012 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 9 September 2012

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!