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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Chambers, C.: Object-Oriented Multi-Methods in Cecil. In: ECOOP 1992. LNCS, vol. 615, pp. 33–56. Springer, Heidelberg (1992)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Longman, Boston (1995)
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)
Torgersen, M.: The Expression Problem Revisited. In: Odersky, M. (ed.) ECOOP 2004. LNCS, vol. 3086, pp. 123–146. Springer, Heidelberg (2004)
Ortin, F., Lopez, B., Perez-Schofield, J.B.G.: Separating Adaptable Persistence Attributes through Computational Reflection. IEEE Software 21(6), 41–49 (2004)
Maes, P.: Computational Reflection. Ph.D. Thesis, Laboratory for Artificial Intelligence, Vrije Universiteit, Amsterdam, the Netherlands (1987)
Meijer, E., Drayton, P.: Static Typing Where Possible, Dynamic Typing When Needed. In: OOPSLA Workshop on Revival of Dynamic Languages, pp. 1–6 (2004)
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)
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)
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)
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)
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)
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)
Cunei, A., Vitek, J.: PolyD: a flexible dispatching framework. In: Object-Oriented Programming Systems and Applications, pp. 487–503. ACM, New York (2005)
Chiles, B., Turner, A.: Dynamic Language Runtime, http://www.codeplex.com/Download?ProjectName=dlr&DownloadId=127512
Ortin, F., Garcia, M.: Union and intersection types to support both dynamic and static typing. Information Processing Letters 111(6), 278–286 (2011)
Ortin, F.: Type Inference to Optimize a Hybrid Statically and Dynamically Typed Language. The Computer Journal 54(11), 1901–1924 (2011)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights 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)