A Programming Language That Combines the Benefits of Static and Dynamic Typing

  • Francisco Ortin
  • Miguel Garcia
Part of the Communications in Computer and Information Science book series (CCIS, volume 170)

Abstract

Dynamically typed languages have recently turned out to be suitable for developing specific scenarios where dynamic adaptability or rapid prototyping are important issues. However, statically typed programming languages commonly offer more opportunities for compiler optimizations and earlier type error detection. Due to the benefits of both approaches, some programming languages such as C# 4.0, Boo, Visual Basic or Objective-C provide both static and dynamic typing. We describe the StaDyn programming language that supports both type systems in the very same programming language. The main contribution of StaDyn is that it keeps gathering type information at compile time even over dynamically typed references, obtaining a better runtime performance, earlier type error detection, and an intuitive combination of statically and dynamically typed code.

Keywords

Dynamic and static typing Duck typing Union types Alias analysis Type inference Constraint-based type systems Separation of concerns 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Pierce, B.C.: Types and Programming Languages. The MIT Press (2002)Google Scholar
  2. 2.
    Venners, B.: Twitter on Scala. A conversation with Steve Jenson, Alex Payne, and Robey Pointer. Artima Developer (April 2009)Google Scholar
  3. 3.
    Meijer, E., Drayton, P.: Dynamic typing when needed: The end of the cold war between programming languages. In: Proceedings of the OOPSLA Workshop on Revival of Dynamic Languages (2004)Google Scholar
  4. 4.
    Abadi, M., Cardelli, L., Pierce, B., Plotkin, G.: Dynamic typing in a statically typed lan-guage. ACM Transactions on Programming Languages and Systems 13(2), 237–268 (1991)CrossRefGoogle Scholar
  5. 5.
    Abadi, M., Cardelli, L., Pierce, B., Rémy, D., Taylor, R.W.: Dynamic typing in polymorphic languages. Journal of Functional Programming 5, 92–103 (1994)Google Scholar
  6. 6.
    Hürsch, W., Lopes, C.: Separation of concerns. Technical Report UN-CCS-95-03, North-eastern University, Boston, USA (1995)Google Scholar
  7. 7.
    Tucker, A.B.: Type Systems. The Computer Science and Engineering Handbook. CRC Press (1997)Google Scholar
  8. 8.
    Ortin, F., Garcia, M.: Union and intersection types to support both dynamic and static typing. Information Processing Letters 111(6), 278–286 (2011)MathSciNetCrossRefGoogle Scholar
  9. 9.
    Ortin, F., Garcia, M.: Supporting Dynamic and Static Typing by means of Union and Intersection Types. In: International Conference on Progress in Informatics and Computing (PIC), pp. 993–999 (2010)Google Scholar
  10. 10.
    Cardelli, L.: Basic polymorphic typechecking. Science of Computer Programming (8), 147–172 (1988)Google Scholar
  11. 11.
    Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)MathSciNetMATHCrossRefGoogle Scholar
  12. 12.
    Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13(4), 451–490 (1991)CrossRefGoogle Scholar
  13. 13.
    Freeman, T., Pfenning, F.: Refinement types for ML. In: Proceedings of the Conference on Programming Language Design and Implementation (PLDI), pp. 268–277 (1991)Google Scholar
  14. 14.
    Plevyak, J., Chien, A.: Precise concrete type inference for object-oriented languages. In: Proceeding of the OOPSLA Conference. SIGPLAN Notices, vol. 29(10) (1994)Google Scholar
  15. 15.
    Pierce, B.C.: Programming with intersection types and bounded polymorphism. Technical Report CMU-CS-91-106, School of Computer Science, Pittsburgh, PA, USA (1992)Google Scholar
  16. 16.
    Bracha, G.: Pluggable type systems. In: OOPSLA Workshop on Revival of Dynamic Languages (October 2004)Google Scholar
  17. 17.
    Canning, P., Cook, W., Hill, W., Olthoff, W., Mitchell, J.: F-bounded polymorphism for object-oriented programming. In: Proceedings of the International Conference on Functional Programming Languages and Computer Architecture, pp. 273–280 (1989)Google Scholar
  18. 18.
    Odersky, M., Sulzmann, M., Wehr, M.: Type inference with constrained types. Theory and Practice of Object Systems 5(1), 35–55 (1999)CrossRefGoogle Scholar
  19. 19.
    Landi, W., Ryder, B.: A safe approximate algorithm for interprocedural pointer aliasing. In: Conference on Programming Language Design and Implementation, pp. 473–489 (1992)Google Scholar
  20. 20.
    Diwan, A., McKinley, K., Moss, J.: Type-based alias analysis. In: Proceedings of the Conference on Programming Language Design and Implementation (PLDI 1991), pp. 106–117 (1991)Google Scholar
  21. 21.
    Emami, M., Ghiya, R., Hendren, L.: Context-sensitive inter-procedural points-to analysis in the presence of function pointers. In: Proceedings of Conference on Programming Language Design and Implementation, pp. 224–256 (1994)Google Scholar
  22. 22.
    Appel, A.: Modern Compiler Implementation in ML. Cambridge University Press (1998)Google Scholar
  23. 23.
    Parr, T.: The Definitive ANTLR Reference: Building Domain-Specific Languages. Pragmatic Bookshelf (2007)Google Scholar
  24. 24.
    Ortin, F., Zapico, D., Cueva, J.M.: Design patterns for teaching type checking in a compiler construction course. IEEE Transactions on Education 50(3), 273–283 (2007)CrossRefGoogle Scholar
  25. 25.
    Redondo, J.M., Ortin, F.: Optimizing reflective primitives of dynamic languages. International Journal of Software Engineering and Knowledge Engineering 18(6), 759–783 (2008)CrossRefGoogle Scholar
  26. 26.
    Ortin, F., Zapico, D., Perez-Schofield, J.B.G., Garcia, M.: Including both static and dy-namic typing in the same programming language. IET Software 4(4), 268–282 (2010)CrossRefGoogle Scholar
  27. 27.
    Ortin, F., Redondo, J.M., Perez-Schofield, J.B.G.: Efficient virtual machine support of runtime structural reflection. Science of Computer Programming 74 (2009)Google Scholar
  28. 28.
    Bracha, G., Griswold, D.: Strongtalk: Typechecking Smalltalk in a production environment. In: Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), pp. 215–230. ACM, New York (1993)Google Scholar
  29. 29.
    Shalit, A.: The Dylan reference manual: the definitive guide to the new object-oriented dynamic language. Addison Wesley Longman Publishing Co. (1996)Google Scholar
  30. 30.
    Codehaus Foundation: Boo, a wrist friendly language for the CLI (2006), http://boo.codehaus.org
  31. 31.
    Cartwright, R., Fagan, M.: Soft Typing. In: Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation (PLDI 1991), pp. 278–292 (1991)Google Scholar
  32. 32.
    Thatte, S.: Quasi-static typing. In: Proceedings of the 17th Symposium on Principles of Programming Languages (POPL), pp. 367–381. ACM, New York (1990)Google Scholar
  33. 33.
    Flanagan, C., Freund, S., Tomb, A.: Hybrid types, invariants, and refinements for imperative objects. In: International Workshop on Foundations and Developments of Object-Oriented Languages, FOOL (2006)Google Scholar
  34. 34.
    Siek, J.G., Taha, W.: Gradual Typing for Objects. In: Bateni, M. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 2–27. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  35. 35.
    Siek, J.G., Vachharajani, M.: Gradual typing with unification-based inference. In: Dynamic Languages Symposium (July 2008)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Francisco Ortin
    • 1
  • Miguel Garcia
    • 1
  1. 1.Computer Science DepartmentUniversity of OviedoOviedoSpain

Personalised recommendations