Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1159876.1159881acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Type-safe distributed programming for OCaml

Published: 16 September 2006 Publication 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.]]
[2]
M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically typed language. ACM TOPLAS, 13(2):237--268, 1991.]]
[3]
M. Abadi, L. Cardelli, B. Pierce, and D. Rémy. Dynamic typing in polymorphic languages. J. Functional Programming, 5(1):111--130, 1995.]]
[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.]]
[5]
J. Billings. A bytecode compiler for Acute, 2005. Computer Science Tripos Part II Dissertation, University of Cambridge.]]
[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.]]
[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.]]
[8]
L. Cardelli. Amber. In Combinators and Functional Programming Languages, LNCS 242, pages 21--70, 1986.]]
[9]
K. Crary, S. Weirich, and G. Morrisett. Intensional polymorphism in type erasure semantics. In Proc. ICFP, pages 301--313, 1998.]]
[10]
P.-M. Deniélou and J. J. Leifer. Abstraction preservation and subtyping in distributed languages, Sep. 2006. In Proc. ICFP, 2006.]]
[11]
D. Dreyer, K. Crary, and R. Harper. A type theory for higher-order modules. In Proc. POPL, 2003.]]
[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/.]]
[13]
J. Furuse. Extensional Polymorphism: Theory and Applications. PhD thesis, Université Paris 7, 2002.]]
[14]
J. Furuse and P. Weis. Entrées/sorties de valeurs en Caml. In J. Francophones des Langages Applicatifs, 2000.]]
[15]
J. Garrigue. Relaxing the value restriction. In International Symposium on Functional and Logic Programming, Nara, LNCS 2998, Apr. 2004.]]
[16]
J. Garrigue. Personal communication, Sept. 2005.]]
[17]
B. Goldberg. Tag-free garbage collection for strongly typed programming languages. Sigplan, 26(6):165--176, 1991.]]
[18]
D. Grossman, G. Morrisett, and S. Zdancewic. Syntactic type abstraction. ACM TOPLAS, 22(6):1037--1080, 2000.]]
[19]
R. Harper and M. Lillibridge. A type-theoretic approach to higher-order modules with sharing. In Proc. 21st POPL, 1994.]]
[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.]]
[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.]]
[22]
J. J. Leifer, G. Peskine, P. Sewell, and K. Wansbrough. Global abstraction-safe marshalling with hash types. In Proc. ICFP, 2003.]]
[23]
X. Leroy. Manifest types, modules, and separate compilation. In Proc. 21st POPL, 1994.]]
[24]
X. Leroy et al. Objective Caml 3.09.1. http://caml.inria.fr, Jan. 2006.]]
[25]
X. Leroy and M. Mauny. Dynamics in ML. Journal of Functional Programming, 3(4):431--463, 1993.]]
[26]
R. Milner, J. Parrow, and D. Walker. A calculus of mobile processes, Parts I + II. Information and Computation, 100(1):1--77, 1992.]]
[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.]]
[28]
J. H. Reppy. Concurrent Programming in ML. Cambridge University Press, 1999.]]
[29]
A. Rossberg. Generativity and dynamic opacity for abstract types. In Proc. 5th PPDP, Aug. 2003.]]
[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.]]
[31]
P. Sewell. Modules, abstract types, and distributed versioning. In Proc. 28th POPL, 2001.]]
[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.]]
[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.]]
[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.]]
[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.]]
[36]
M. R. Shinwell, A. M. Pitts, and M. J. Gabbay. FreshML: Programming with binders made simple. In Proc. ICFP, 2003.]]
[37]
B. Thomsen, L. Leth, and T.-M. Kuo. A Facile tutorial. In CONCUR'96, LNCS 1119, 1996.]]
[38]
J. Verlaguet. Acaml: An extension of OCaml with Acute-like marshalling, Oct. 2005. Masters Dissertation.]]
[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.]]
[40]
A. K. Wright. Simple imperative polymorphism. Lisp and Symbolic Computation, 8(4):343--355, 1995.]]

Cited By

View all
  • (2018)A programming model and foundation for lineage-based distributed computationJournal of Functional Programming10.1017/S095679681800003528Online publication date: 12-Mar-2018
  • (2012)Typing unmarshalling without marshalling typesACM SIGPLAN Notices10.1145/2398856.236456947:9(287-298)Online publication date: 9-Sep-2012
  • (2012)Typing unmarshalling without marshalling typesProceedings of the 17th ACM SIGPLAN international conference on Functional programming10.1145/2364527.2364569(287-298)Online publication date: 9-Sep-2012
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 16 September 2006

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. HashCaml
  2. objective Caml
  3. type-safe marshalling

Qualifiers

  • Article

Conference

ICFP06
Sponsor:

Acceptance Rates

Overall Acceptance Rate 6 of 11 submissions, 55%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)6
  • Downloads (Last 6 weeks)0
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2018)A programming model and foundation for lineage-based distributed computationJournal of Functional Programming10.1017/S095679681800003528Online publication date: 12-Mar-2018
  • (2012)Typing unmarshalling without marshalling typesACM SIGPLAN Notices10.1145/2398856.236456947:9(287-298)Online publication date: 9-Sep-2012
  • (2012)Typing unmarshalling without marshalling typesProceedings of the 17th ACM SIGPLAN international conference on Functional programming10.1145/2364527.2364569(287-298)Online publication date: 9-Sep-2012
  • (2011)Typed first-class communication channels and mobility for concurrent scripting languagesProceedings of the 4th international conference on Software Language Engineering10.1007/978-3-642-28830-2_22(378-387)Online publication date: 3-Jul-2011
  • (2010)Nomadic pictACM Transactions on Programming Languages and Systems10.1145/1734206.173420932:4(1-63)Online publication date: 22-Apr-2010
  • (2008)A secure compiler for session abstractionsJournal of Computer Security10.5555/1454415.145441916:5(573-636)Online publication date: 1-Dec-2008
  • (2008)Dynamic rebinding for marshalling and update, via redex-time and destruct-time reductionJournal of Functional Programming10.1017/S095679680700660018:4(437-502)Online publication date: 1-Jul-2008
  • (2008)A Protocol Compiler for Secure Sessions in MLTrustworthy Global Computing10.1007/978-3-540-78663-4_19(276-293)Online publication date: 2008
  • (2007)A protocol compiler for secure sessions in MLProceedings of the 3rd conference on Trustworthy global computing10.5555/1793574.1793595(276-293)Online publication date: 5-Nov-2007
  • (2007)Practical generic programming in OCamlProceedings of the 2007 workshop on Workshop on ML10.1145/1292535.1292548(83-94)Online publication date: 2-Oct-2007
  • Show More Cited By

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media