What is the reasoning behind the lack of conversions when passing parameters

Carl Sturtivant sturtivant at gmail.com
Sat Feb 3 18:53:02 UTC 2024


On Saturday, 3 February 2024 at 17:58:22 UTC, Walter Bright wrote:
> P.S. Overloading is often used excessively, even in the DMD 
> source code.

I wonder why overloading doesn't need an `overload` keyword at 
the site of an overloaded function definition.

After all, it's about a situation where the possible repertoire 
of functions that could be called at the site of a function call 
is extended.

This is much like `override` when a method call's repertoire is 
extended.

This last design decision is great because it makes overt what's 
going on at the textual point where new code is being written. 
The compiler ensures the author knows about the interaction with 
existing code.

No doubt there are some ramifications to having an `overload` 
keyword with the obvious semantics. But the general effect would 
be to discourage overloading so that its use is an overt decision.

Was the idea of an `overload` keyword ever considered for D?



More information about the Digitalmars-d mailing list