What is the reasoning behind the lack of conversions when passing parameters
Walter Bright
newshound2 at digitalmars.com
Sat Feb 3 17:58:22 UTC 2024
On 2/2/2024 10:42 PM, Carl Sturtivant wrote:
> On Saturday, 3 February 2024 at 03:19:00 UTC, Walter Bright wrote:
>> I tried to make overloading in D much simpler, but it's still overly complex.
>
> It is apparent that it is overloading and `alias this` in its present form that
> are the mistakes. Not the initialization mechanism.
>
> Without that pair of mistakes, having parameter passing being initialization
> would be as simple as, well, initialization. Surely we don't think there's a
> design problem with initialization implicitly calling constructors?
I agree it is in conflict with overloading. But overloading and alias this are
very useful features. Language design is all about making tradeoffs.
It's like designing a house. Making the bathroom bigger means making the bedroom
smaller.
P.S. Overloading is often used excessively, even in the DMD source code.
More information about the Digitalmars-d
mailing list