Pre-RFC: Named arguments

Overloading based on arity alone is isomorphic with optional/default arguments, and there are lots of languages with optional/default arguments.

The same logic allows me to observe that Rust already has overloading based on the type of one (specially marked in the syntax) argument; we just call it dispatching to a trait implementation. Which means that it is already necessary to know the type of that argument in order to read code. Yes, a trait comes with an interface contract — every implementation of std::ops::Add is supposed to perform addition, for some definition of "addition" — but that is only enforced by convention, and there's tons of room for "creative" interpretation of the documentation.

12 Likes