Safe Cross-Language Inheritance

  • Kathryn E. Gray
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5142)


Inheritance is a standard means for reuse and for interfacing with external libraries. In a multi-language software product, extending a class written in a statically-typed language with a dynamically-typed class can require a significant number of manual indirections and other error-prone complications. Building on our previous interoperability work, we introduce a technique that allows safe, easy inheritance across languages. We demonstrate our technique for cross-language inheritance with a statically-typed object calculus and a dynamically-typed object calculus, where a statically-typed class can extend a dynamically-typed one and vice versa. We provide a proof sketch of soundness, as well as a guarantee that dynamic type errors do not arise due to statically-typed expressions.


Reduction Rule Class Hierarchy Dynamic Type Annotation Relation Type Check 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Flatt, M., Findler, R.B.: PLT MrEd: Graphical Toolbox Manual. Technical Report PLT-TR-2007-2-v370, PLT Scheme (2007)Google Scholar
  2. 2.
    Koenig, D., Glover, A., King, P., Laforge, G., Skeet, J.: Groovy in Action. Manning Publications (2007)Google Scholar
  3. 3.
    Gray, K.E., Findler, R.B., Flatt, M.: Fine-grained interoperability through mirrors and contracts. In: Proc. ACM Conf. on OOPSLA (2005)Google Scholar
  4. 4.
    Tobin-Hochstadt, S., Felleisen, M.: Interlanguage migration: From scripts to programs. In: Proc. of ACM Dynamic Languages Symposium (2006)Google Scholar
  5. 5.
    Wadler, P., Findler, R.B.: Well-typed programs can’t be blamed. In: Proc. ACM Workshop on Scheme and Functional Programming (2007)Google Scholar
  6. 6.
    Gray, K.E.: A model of Java/Scheme interoperability. In: Findler, R.B., Flatt, M., Felleisen, M. (eds.) Designing, Developing, and Debugging Programming Language Models. MIT Press, Cambridge (to appear, 2008)Google Scholar
  7. 7.
    Matthews, J., Findler, R.B., Flatt, M., Felleisen, M.: A visual environment for developing context-sensitive term rewriting systems. In: van Oostrom, V. (ed.) RTA 2004. LNCS, vol. 3091. Springer, Heidelberg (2004)Google Scholar
  8. 8.
    Igarashi, A., Pierce, B., Wadler, P.: Featherweight Java: A Minimal Core Calculus for Java and GJ. In: Proc. ACM Conf. on OOPSLA (1999)Google Scholar
  9. 9.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: A Programmer’s Reduction Semantics for Classes and Mixins. In: Alves-Foss, J. (ed.) Formal Syntax and Semantics of Java. LNCS, vol. 1523. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  10. 10.
    Flatt, M.: PLT MzLib: Libraries manual. Technical Report PLT-TR-2007-n-v370, PLT Scheme (2007)Google Scholar
  11. 11.
    Siek, J.G., Taha, W.: Gradual typing for objects. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 12.
    Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Proc. ACM Workshop on Scheme and Functional Programming (2006)Google Scholar
  13. 13.
    Matthews, J., Findler, R.B.: Operational semantics for multi-language programs. In: Proc. ACM Conf. on Principles of Programming Languages (2007)Google Scholar
  14. 14.
    Abadi, M., Cardelli, L., Pierce, B., Plotkin, G.: Dynamic Typing in a Statically Typed Language. ACM J. Tran. on Prog. Languages and Systems 13 (1991)Google Scholar
  15. 15.
    Duggan, D.: Dynamic Typing for Distributed Programming in Polymorphic Languages. ACM J. Tran. on Prog. Languages and Systems 21, 11–45 (1999)CrossRefGoogle Scholar
  16. 16.
    Bracha, G., Griswold, D.: Strongtalk: Typechecking Smalltalk in a Production Environment. In: Proc. ACM Conf. on OOPSLA (1993)Google Scholar
  17. 17.
    Goldberg, A., Robson, D.: Smalltalk-80: The Language and its Implementation. Addison-Wesley, Reading (1983)zbMATHGoogle Scholar
  18. 18.
    Cardelli, L.: Amber. In: Cousineau, G., Curien, P.-L., Robinet, B. (eds.) LITP 1985. LNCS, vol. 242. Springer, Heidelberg (1986)Google Scholar
  19. 19.
    Benton, N.: Embedded Interpreters. Journal of Functional Programming 15 (2005)Google Scholar
  20. 20.
    Ramsey, N.: Embedding an Interpreted Language Using Higher-Order Functions and Types. Journal of Functional Programming (to appear) Initial version in ACM Workshop on Interpreters, Virtual Machines and Emulators (June 2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Kathryn E. Gray
    • 1
  1. 1.Computer LaboratoryUniversity of CambridgeUK

Personalised recommendations