Fine-grained interoperability through mirrors and contracts

As a value flows across the boundary between interoperating languages, it must be checked and converted to fit the types and representations of the target language. For simple forms of data, the checks and coercions can be immediate; for higher order data, such as functions and objects, some must be delayed until the value is used in a particular way. Typically, these coercions and checks are implemented by an ad-hoc mixture of wrappers, reflection, and dynamic predicates. We observe that 1) the wrapper and reflection operations fit the profile of mirrors, 2) the checks correspond to contracts, and 3) the timing and shape of mirror operations coincide with the timing and shape of contract operations. Based on these insights, we present a new model of interoperability that builds on the ideas of mirrors and contracts, and we describe an interoperable implementation of Java and Scheme that is guided by the model.

[1]  G. vanRossum Python reference manual , 1995 .

[2]  Jennifer Hamilton Interlanguage Object Sharing with SOM , 1996, COOTS.

[3]  Massachusett Framingham,et al.  The Common Object Request Broker: Architecture and Specification Version 3 , 2003 .

[4]  Gilad Bracha,et al.  Mirrors: design principles for meta-level facilities of object-oriented programming languages , 2004, OOPSLA.

[5]  Scott G. Miller,et al.  SISC: A Complete Scheme Interpreter in Java , 2003 .

[6]  Matthew Flatt,et al.  ProfessorJ: a gradual introduction to Java through language levels , 2003, OOPSLA '03.

[7]  Guido Rossum,et al.  Python Reference Manual , 2000 .

[8]  Roger Riggs,et al.  A distributed object model for the java TM system , 1996 .

[9]  Peter Norvig,et al.  SILK - a playful blend of Scheme and Java , 2000 .

[10]  Matthias Felleisen,et al.  A Programmer's Reduction Semantics for Classes and Mixins , 1999, Formal Syntax and Semantics of Java.

[11]  Matthias Felleisen,et al.  DrScheme: A Pedagogic Programming Environment for Scheme , 1997, PLILP.

[12]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[13]  Matthias Felleisen,et al.  A Tail-Recursive Semantics for Stack Inspections , 2003, ESOP.

[14]  Nick Benton,et al.  Interlanguage working without tears: blending SML with Java , 1999, ICFP '99.

[15]  Dale Rogerson,et al.  Inside COM , 1997 .

[16]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[17]  Matthias Felleisen,et al.  Contracts for higher-order functions , 2002, ICFP '02.

[18]  Matthias Blume No-Longer-Foreign: Teaching an ML compiler to speak C "natively" , 2001, Electron. Notes Theor. Comput. Sci..

[19]  Dominic Duggan,et al.  Dynamic typing for distributed programming in polymorphic languages , 1999, TOPL.

[20]  Martín Abadi,et al.  Dynamic typing in a statically-typed language , 1989, POPL '89.

[21]  David S. Platt,et al.  Introducing Microsoft® .NET , 2001 .

[22]  David M. Beazley,et al.  SWIG: An Easy to Use Tool for Integrating Scripting Languages with C and C++ , 1996, Tcl/Tk Workshop.

[23]  Christian Queinnec,et al.  The influence of browsers on evaluators or, continuations to program web servers , 2000, ICFP '00.

[24]  Matthias Felleisen,et al.  Semantic Casts: Contracts and Structural Subtyping in a Nominal World , 2004, ECOOP.

[25]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[26]  Gilad Bracha,et al.  Strongtalk: typechecking Smalltalk in a production environment , 1993, OOPSLA '93.

[27]  David S. Platt Introducing Microsoft .NET, Second Edition , 2002 .

[28]  Guy L. Steele,et al.  Java Language Specification, Second Edition: The Java Series , 2000 .

[29]  Per Bothner,et al.  Kawa: compiling scheme to java , 1998 .

[30]  Jeffrey S. Foster,et al.  Checking type safety of foreign function calls , 2005, PLDI '05.

[31]  Matthew Flatt,et al.  PLT MzScheme: Language Manual , 2000 .

[32]  Roger Riggs,et al.  A Distributed Object Model for the Java System , 1996, Comput. Syst..

[33]  Jennifer Hamilton,et al.  Language integration in the common language runtime , 2003, SIGP.

[34]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[35]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[36]  Matthew Flatt,et al.  Compiling Java to PLT Scheme , 2004 .

[37]  Matthew Flatt Composable and compilable macros:: you want it when? , 2002, ICFP '02.

[38]  Ricky E. Sward,et al.  Weaving Ada 95 into the .net environment , 2002, SIGAda.