Home / Current Issue / Paper 1717077
Formal Analysis of Overloaded Subprogram Resolution Rules: Ambiguity, Coercion, and Default Parameters in C++, Java, C#, and Ada
Subject area: Science,Engineering and Technology · Area of research: Programming Language Theory / Software Engineering
DOI: https://doi.org/10.64388/IREV9I10-1717077
Abstract
A simple feature in the design of a statically typed programming language is subprogram overloading: the same identifier can have a variety of implementations in which the arguments have different types. But when implicit type coercion and default parameters are used in conjunction with overloading, the resolution is much more complicated and may result in ambiguities not automatically resolved by the compiler. This paper provides a formal comparative study of overloaded subprogram resolution in four popular languages: C++, Java, C# and Ada. It compares the language-specific mechanisms such as conversion-rank hierarchy in C++, three-phase method invocation procedure in Java, optional parameter and user-defined conversion rules in C#, and top-down expected-type propagation in Ada . The paper shows that none of the four languages can ensure SNA when implicit coercions of equal rank interact with overloaded candidates at the same time, and suggests design principles such as total-order ranking function and default-conscious candidate selection, which would restore SNA in such situations.
Keywords
Overload Resolution, Type Coercion, Ambiguity, Default Parameters, C++, Java, C#, Ada
References
[1] Ada-Auth (2012) Annotated Ada Reference Manual: Language and Standard Libraries. Section 8.6. Ada Rapporteur Group / ISO/IEC 8652:2012. Available at: http://www.ada-auth.org/standards/aarm12_w_tc1/html/AA-8-6.html (Accessed: 1 April 2026).
[2] Allen, E., et al. (2008) 'On coercion for object-oriented programming languages', in Proc. OOPSLA '08. New York, NY: ACM, pp. 3–22.
[3] ECMA International (2022) ECMA-334: C# Language Specification. 6th edn. Geneva: ECMA International. Available at: https://www.ecma-international.org/publications-and-standards/standards/ecma-334/ (Accessed: 1 April 2026).
[4] ISO/IEC (2020) ISO/IEC 14882:2020 — Programming languages: C++ (6th ed.). International Organization for Standardization.
[5] Luo, Z. (2008) 'Coercions in a polymorphic type system.' Mathematical Structures in Computer Science, 18(4), pp. 729–751.
[6] Scott, M. L. (2016) Programming language pragmatics (4th ed.). Morgan Kaufmann. ISBN: 978-0124104099.
[7] Stroustrup, B. (2013) The C++ programming language (4th ed.). Addison-Wesley. ISBN: 978-0321563842.
[8] Swamy, N., et al. (2009) 'A Theory of Typed Coercions and Its Applications.' ACM SIGPLAN Notices, 44(9), pp. 329–340. https://doi.org/10.1145/1631687.1596598.
How to cite this paper
@article{1717077,
author = {Aibuki Adeyinka, Owolabi Hammed, Ogozi Confidence, Adewole Philips},
title = {Formal Analysis of Overloaded Subprogram Resolution Rules: Ambiguity, Coercion, and Default Parameters in C++, Java, C#, and Ada},
journal = {Iconic Research And Engineering Journals},
year = {2026},
volume = {9},
number = {10},
pages = {3673-3678},
issn = {2456-8880},
url = {https://www.irejournals.com/formatedpaper/1717077.pdf},
abstract = {A simple feature in the design of a statically typed programming language is subprogram overloading: the same identifier can have a variety of implementations in which the arguments have different types. But when implicit type coercion and default parameters are used in conjunction with overloading, the resolution is much more complicated and may result in ambiguities not automatically resolved by the compiler. This paper provides a formal comparative study of overloaded subprogram resolution in four popular languages: C++, Java, C# and Ada. It compares the language-specific mechanisms such as conversion-rank hierarchy in C++, three-phase method invocation procedure in Java, optional parameter and user-defined conversion rules in C#, and top-down expected-type propagation in Ada . The paper shows that none of the four languages can ensure SNA when implicit coercions of equal rank interact with overloaded candidates at the same time, and suggests design principles such as total-order ranking function and default-conscious candidate selection, which would restore SNA in such situations.},
keywords = {Overload Resolution, Type Coercion, Ambiguity, Default Parameters, C++, Java, C#, Ada},
month = {April},
doi = {https://doi.org/10.64388/IREV9I10-1717077}
}