skip to main content
10.1145/1159876.1159881acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Type-safe distributed programming for OCaml

Published:16 September 2006Publication History

ABSTRACT

Existing ML-like languages guarantee type-safety, ensuring memory safety and protecting the invariants of abstract types, but only within single executions of single programs. Distributed programming is becoming ever more important, and should benefit even more from such guarantees. In previous work on theoretical calculi and the Acute prototype language we outlined techniques to provide them for simple languages.In this paper we put these ideas into practice, describing the HashCaml extension to the OCaml bytecode compiler, which supports type-safe and abstraction-safe marshalling, together with related naming constructs. Our contribution is threefold: (1) We show how to define globally meaningful runtime type names for key OCaml type constructs that were not covered in our previous work, dealing with the generativity issues involved: user-defined variant and record types, substructures, functors, arbitrary ascription, separate compilation, and external C functions. (2) We support marshalling within polymorphic functions by type-passing, requiring us to build compositional runtime type names and revisit the OCaml relaxed value restriction. We show that with typed marshalling one must fall back to the SML97 value restriction. (3) We show how the above can be implemented with reasonable performance as an unintrusive modification to the existing OCaml language, implementation, and standard libraries. An alpha release of HashCaml, capable of bootstrapping itself, is available, along with an example type-safe distributed communication library written in the language.

References

  1. Java™ object serialization specification 1.5.0. Technical report, Sun Microsystems, Apr. 2004.]]Google ScholarGoogle Scholar
  2. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically typed language. ACM TOPLAS, 13(2):237--268, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Abadi, L. Cardelli, B. Pierce, and D. Rémy. Dynamic typing in polymorphic languages. J. Functional Programming, 5(1):111--130, 1995.]]Google ScholarGoogle ScholarCross RefCross Ref
  4. G. Bierman, M. Hicks, P. Sewell, G. Stoyle, and K. Wansbrough. Dynamic rebinding for marshalling and update, with destruct-time λ. In Proc. ICFP, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. Billings. A bytecode compiler for Acute, 2005. Computer Science Tripos Part II Dissertation, University of Cambridge.]]Google ScholarGoogle Scholar
  6. J. Billings, P. Sewell, M. Shinwell, and R. Strniša. HashCaml 3.09.1-alpha-785. http://www.cl.cam.ac.uk/users/pes20/hashcaml, Apr. 2006.]]Google ScholarGoogle Scholar
  7. J. Billings, P. Sewell, M. Shinwell, and R. Strniša. The implementation of HashCaml, Apr. 2006. http://www.cl.cam.ac.uk/users/pes20/hashcaml.]]Google ScholarGoogle Scholar
  8. L. Cardelli. Amber. In Combinators and Functional Programming Languages, LNCS 242, pages 21--70, 1986.]] Google ScholarGoogle Scholar
  9. K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type erasure semantics. In Proc. ICFP, pages 301--313, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. P.-M. Deniélou and J. J. Leifer. Abstraction preservation and subtyping in distributed languages, Sep. 2006. In Proc. ICFP, 2006.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. Dreyer, K. Crary, and R. Harper. A type theory for higher-order modules. In Proc. POPL, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. C. Fournet, F. L. Fessant, L. Maranget, and A. Schmitt. The JoCaml language beta release documentation and user's manual, Jan. 2001. http://moscova.inria.fr/jocaml/.]]Google ScholarGoogle Scholar
  13. J. Furuse. Extensional Polymorphism: Theory and Applications. PhD thesis, Université Paris 7, 2002.]]Google ScholarGoogle Scholar
  14. J. Furuse and P. Weis. Entrées/sorties de valeurs en Caml. In J. Francophones des Langages Applicatifs, 2000.]]Google ScholarGoogle Scholar
  15. J. Garrigue. Relaxing the value restriction. In International Symposium on Functional and Logic Programming, Nara, LNCS 2998, Apr. 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  16. J. Garrigue. Personal communication, Sept. 2005.]]Google ScholarGoogle Scholar
  17. B. Goldberg. Tag-free garbage collection for strongly typed programming languages. Sigplan, 26(6):165--176, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. D. Grossman, G. Morrisett, and S. Zdancewic. Syntactic type abstraction. ACM TOPLAS, 22(6):1037--1080, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. R. Harper and M. Lillibridge. A type-theoretic approach to higher-order modules with sharing. In Proc. 21st POPL, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. R. Harper and B. C. Pierce. Design issues in advanced module systems, 2005. Chapter in Advanced Topics in Types and Programming Languages, B. C. Pierce, editor.]]Google ScholarGoogle Scholar
  21. G. Henry, M. Mauny, and E. Chailloux. Typer la désérialisation sans sérialiser les types. In Journées Francophones des Langages Applicatifs, Jan. 2006.]]Google ScholarGoogle Scholar
  22. J. J. Leifer, G. Peskine, P. Sewell, and K. Wansbrough. Global abstraction-safe marshalling with hash types. In Proc. ICFP, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. X. Leroy. Manifest types, modules, and separate compilation. In Proc. 21st POPL, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. X. Leroy et al. Objective Caml 3.09.1. http://caml.inria.fr, Jan. 2006.]]Google ScholarGoogle Scholar
  25. X. Leroy and M. Mauny. Dynamics in ML. Journal of Functional Programming, 3(4):431--463, 1993.]]Google ScholarGoogle ScholarCross RefCross Ref
  26. R. Milner, J. Parrow, and D. Walker. A calculus of mobile processes, Parts I + II. Information and Computation, 100(1):1--77, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. B. C. Pierce and D. N. Turner. Pict: A programming language based on the pi-calculus. In Proof, Language and Interaction: Essays in Honour of Robin Milner, pages 455--494. MIT Press, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. J. H. Reppy. Concurrent Programming in ML. Cambridge University Press, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. A. Rossberg. Generativity and dynamic opacity for abstract types. In Proc. 5th PPDP, Aug. 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Rossberg, D. L. Botlan, G. Tack, T. Brunklaus, and G. Smolka. Alice through the looking glass. In Trends in Functional Programming, Vol. 5, Feb. 2006.]]Google ScholarGoogle Scholar
  31. P. Sewell. Modules, abstract types, and distributed versioning. In Proc. 28th POPL, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. P. Sewell, J. J. Leifer, K. Wansbrough, M. Allen-Williams, F. Zappa Nardelli, P. Habouzit, and V. Vafeiadis. Acute: High-level programming language design for distributed computation. Design rationale and language definition. Technical Report 605, University of Cambridge Computer Laboratory, Oct. 2004. Also published as INRIA RR-5329. 193pp.]]Google ScholarGoogle Scholar
  33. P. Sewell, J. J. Leifer, K. Wansbrough, F. Zappa Nardelli, M. Allen-Williams, P. Habouzit, and V. Vafeiadis. Acute: High-level programming language design for distributed computation. In Proc. ICFP, Sept. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. P. Sewell, J. J. Leifer, K. Wansbrough, F. Zappa Nardelli, M. Allen-Williams, P. Habouzit, and V. Vafeiadis. Acute: High-level programming language design for distributed computation. Dec. 2005. Submitted for publication. http://www.cl.cam.ac.uk/users/pes20/acute/paper3.ps.]]Google ScholarGoogle Scholar
  35. P. Sewell, P. T. Wojciechowski, and B. C. Pierce. Location-independent communication for mobile agents: a two-level architecture. In Internet Programming Languages, LNCS 1686, pages 1--31, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M. R. Shinwell, A. M. Pitts, and M. J. Gabbay. FreshML: Programming with binders made simple. In Proc. ICFP, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. B. Thomsen, L. Leth, and T.-M. Kuo. A Facile tutorial. In CONCUR'96, LNCS 1119, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. J. Verlaguet. Acaml: An extension of OCaml with Acute-like marshalling, Oct. 2005. Masters Dissertation.]]Google ScholarGoogle Scholar
  39. D. Vytiniotis, G. Washburn, and S. Weirich. An open and shut typecase. In Proc. ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI), Jan. 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. A. K. Wright. Simple imperative polymorphism. Lisp and Symbolic Computation, 8(4):343--355, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Type-safe distributed programming for OCaml

        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
        • Published in

          cover image ACM Conferences
          ML '06: Proceedings of the 2006 workshop on ML
          September 2006
          102 pages
          ISBN:1595934839
          DOI:10.1145/1159876

          Copyright © 2006 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 16 September 2006

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          Overall Acceptance Rate6of11submissions,55%

          Upcoming Conference

          ICFP '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader