Skip to main content

Achieving Multiple Dispatch in Hybrid Statically and Dynamically Typed Languages

  • Conference paper

Part of the book series: Advances in Intelligent Systems and Computing ((AISC,volume 206))

Abstract

Multiple dispatch is a feature provided by some programming languages, in which the actual method to be executed is dynamically determined by the runtime types of its arguments. Although some programming languages such as CLOS, Xtend and Dylan provide this feature, many widespread languages such as Java, C# and C++ only support single dispatch by means of dynamic binding. Therefore, different implementation techniques are commonly used to obtain multiple dispatch from within these single-dispatch languages. We propose a new approach to obtain multiple dispatch in single-dispatch hybrid static and dynamic typing languages. Using C# as an example, the proposed approach is compared with the existing ones, considering factors such as software maintainability and readability, code size, parameter generalization, compile-time type checking, and runtime performance. The example implementation of the hybrid statically and dynamically typed approach in .Net has shown a runtime performance 1.26 times lower than the statically typed approach, and 6.27 times higher than the dynamically type one.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   259.00
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   329.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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Chambers, C.: Object-Oriented Multi-Methods in Cecil. In: ECOOP 1992. LNCS, vol. 615, pp. 33–56. Springer, Heidelberg (1992)

    Chapter  Google Scholar 

  2. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Longman, Boston (1995)

    Google Scholar 

  3. 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)

    Article  Google Scholar 

  4. Torgersen, M.: The Expression Problem Revisited. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 123–146. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  5. Ortin, F., Lopez, B., Perez-Schofield, J.B.G.: Separating Adaptable Persistence Attributes through Computational Reflection. IEEE Software 21(6), 41–49 (2004)

    Article  Google Scholar 

  6. Maes, P.: Computational Reflection. Ph.D. Thesis, Laboratory for Artificial Intelligence, Vrije Universiteit, Amsterdam, the Netherlands (1987)

    Google Scholar 

  7. Meijer, E., Drayton, P.: Static Typing Where Possible, Dynamic Typing When Needed. In: OOPSLA Workshop on Revival of Dynamic Languages, pp. 1–6 (2004)

    Google Scholar 

  8. Bierman, G., Meijer, E., Torgersen, M.: Adding Dynamic Types to C#. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 76–100. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  9. Ortin, F., Zapico, D., Perez-Schofield, J.B.G., Garcia, M.: Including both Static and Dynamic Typing in the same Programming Language. IET Software 4(4), 268–282 (2010)

    Article  Google Scholar 

  10. Ortin, F., Redondo, J.M., Perez-Schofield, J.B.G.: Efficient virtual machine support of runtime structural reflection. Science of Computer Programming 74(10), 836–860 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  11. Redondo, J.M., Ortin, F., Cueva, J.M.: Optimizing Reflective Primitives of Dynamic Languages. International Journal of Software Engineering and Knowledge Engineering 18(6), 759–783 (2008)

    Article  Google Scholar 

  12. Georges, A., Buytaert, D., Eeckhout, L.: Statistically rigorous Java performance evaluation. In: Object-Oriented Programming Systems and Applications, pp. 57–76. ACM, New York (2007)

    Google Scholar 

  13. Redondo, J.M., Ortin, F.: Efficient Support of Dynamic Inheritance for Class and Prototype-based Languages. Journal of Software and Systems, 1–24 (2012) (to be published)

    Google Scholar 

  14. Cunei, A., Vitek, J.: PolyD: a flexible dispatching framework. In: Object-Oriented Programming Systems and Applications, pp. 487–503. ACM, New York (2005)

    Google Scholar 

  15. Chiles, B., Turner, A.: Dynamic Language Runtime, http://www.codeplex.com/Download?ProjectName=dlr&DownloadId=127512

  16. Ortin, F., Garcia, M.: Union and intersection types to support both dynamic and static typing. Information Processing Letters 111(6), 278–286 (2011)

    Article  MathSciNet  Google Scholar 

  17. Ortin, F.: Type Inference to Optimize a Hybrid Statically and Dynamically Typed Language. The Computer Journal 54(11), 1901–1924 (2011)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Francisco Ortin .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Ortin, F., Garcia, M., Redondo, J.M., Quiroga, J. (2013). Achieving Multiple Dispatch in Hybrid Statically and Dynamically Typed Languages. In: Rocha, Á., Correia, A., Wilson, T., Stroetmann, K. (eds) Advances in Information Systems and Technologies. Advances in Intelligent Systems and Computing, vol 206. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-36981-0_65

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-36981-0_65

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-36980-3

  • Online ISBN: 978-3-642-36981-0

  • eBook Packages: EngineeringEngineering (R0)

Publish with us

Policies and ethics