Skip to main content

Adding Dynamic Types to C\(^\sharp\)

  • Conference paper
ECOOP 2010 – Object-Oriented Programming (ECOOP 2010)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6183))

Included in the following conference series:

Abstract

Developers using statically typed languages such as C\(^\sharp\) and Java are increasingly having to interoperate with APIs and object models defined in dynamic languages. This impedance mismatch results in code that is difficult to understand, awkward to analyze, and expensive to maintain. In this paper we describe new features in C\(^\sharp\) 4.0 that support the safe combination of dynamically and statically typed code by deferring type checking of program fragments with static type dynamic until runtime. When executed, these dynamic code fragments are type-checked and resolved using the same rules as statically typed code. We formalize these features in a core fragment of C\(^\sharp\) and prove important safety properties. In particular, we show that subtyping remains transitive.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abadi, M., Cardelli, L., Pierce, B.C., Plotkin, G.D.: Dynamic typing in a statically-typed language. In: Proceedings of POPL (1989)

    Google Scholar 

  2. Aiken, A., Wimmers, E.L., Lakshman, T.K.: Soft typing with conditional types. In: Proceedings of POPL (1994)

    Google Scholar 

  3. Anderson, C., Drossopoulou, S.: BabyJ: From object based to class based programming via types. In: Proceedings of WOOD (2003)

    Google Scholar 

  4. Bierman, G.M.: Formalizing and extending C\(^{\sharp}\) type inference. In: Proceedings of FOOL (2007)

    Google Scholar 

  5. Bierman, G.M., Meijer, E., Torgersen, M.: Lost in translation: Formalizing proposed extensions to C\(^{\sharp}\). In: Proceedings of OOPSLA (2007)

    Google Scholar 

  6. Bierman, G.M., Parkinson, M.J.: Effects and effect inference for a core Java calculus. In: Proceedings of WOOD (2003)

    Google Scholar 

  7. Bierman, G.M., Parkinson, M.J., Pitts, A.M.: MJ: An imperative core calculus for Java and Java with effects. Technical Report 563, University of Cambridge (2003)

    Google Scholar 

  8. Breazu-Tannen, V., Coquand, T., Gunter, C.A., Scedrov, A.: Inheritance as implicit coercion. Information and computation 93(1), 172–221 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  9. Cartwright, R., Fagan, M.: Soft typing. In: Proceedings of PLDI (1991)

    Google Scholar 

  10. Findler, R., Wadler, P.: Well-typed programs can’t be blamed. In: Proceedings of ESOP (2009)

    Google Scholar 

  11. Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: Proceedings of POPL (1998)

    Google Scholar 

  12. Hejlsberg, A., Torgersen, M., Wiltamuth, S., Golde, P.: The C\(^\sharp\) Programming Language, 3rd edn. Addison-Wesley, Reading (2009)

    Google Scholar 

  13. Henglein, F.: Dynamic typing: syntax and proof theory. Science of Computer Programming 22(3), 197–230 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  14. Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: A minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)

    Article  Google Scholar 

  15. Kennedy, A., Syme, D.: Transposing F to C\(^\sharp\). Concurrency and Computation 16(7) (2004)

    Google Scholar 

  16. Knowles, K., Tomb, A., Gronski, J., Freund, S.N., Flanagan, C.: Sage: Unified hybrid checking for first-class types, general refinement types and Dynamic. Technical report, UCSC (2007)

    Google Scholar 

  17. Meijer, E., Drayton, P.: Static typing where possible, dynamic typing when needed: The end of the cold war between programming languages. In: OOPSLA Workshop on Revival of Dynamic Languages (2004)

    Google Scholar 

  18. Pierce, B.C.: Types and programming languages. MIT Press, Cambridge (2002)

    Google Scholar 

  19. Pierce, B.C., Turner, D.N.: Local type inference. In: Proceedings of POPL (1998)

    Google Scholar 

  20. Siek, J., Taha, W.: Gradual typing for functional languages. In: Proceedings of Scheme and Functional Programming Workshop (2006)

    Google Scholar 

  21. Siek, J., Taha, W.: Gradual typing for objects. In: Proceedings of ECOOP (2007)

    Google Scholar 

  22. Thatte, S.: Quasi-static typing. In: Proceedings of POPL (1990)

    Google Scholar 

  23. Tobin-Hochstadt, S., Felleisen, M.: Interlanguage migration: From scripts to programs. In: Proceedings of DSL (2006)

    Google Scholar 

  24. Tobin-Hochstadt, S., Felleisen, M.: The design and implementation of Typed Scheme. In: Proceedings of POPL (2007)

    Google Scholar 

  25. Wrigstad, T., Zappa Nardelli, F., Lebresne, S., Östlund, J., Vitek, J.: Integrating typed and untyped code in a scripting language. In: Proceedings of POPL (2010)

    Google Scholar 

  26. Yu, D., Kennedy, A., Syme, D.: Formalization of generics for the .NET common language runtime. In: Proceedings of POPL (2004)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bierman, G., Meijer, E., Torgersen, M. (2010). Adding Dynamic Types to C\(^\sharp\) . In: D’Hondt, T. (eds) ECOOP 2010 – Object-Oriented Programming. ECOOP 2010. Lecture Notes in Computer Science, vol 6183. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-14107-2_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-14107-2_5

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-14106-5

  • Online ISBN: 978-3-642-14107-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics