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

Basile B. b2.temp at gmx.com
Tue Feb 6 00:56:04 UTC 2024


On Monday, 5 February 2024 at 23:23:36 UTC, Basile B. wrote:
> On Monday, 5 February 2024 at 19:16:40 UTC, Basile B. wrote:
>> On Saturday, 3 February 2024 at 18:53:02 UTC, Carl Sturtivant 
>> wrote:
>>> [...]
>>
>> What D does is "implicit" overload creation. If the same name 
>> already exists in the current scope it just creates an 
>> "overload set", adding possible candidates in a sort of linked 
>> list. There are restrictions however on what can be part of a 
>> set, for example you cannot overload a function declaration 
>> with an int declaration.
>>
>> However this becomes complicated when it's about eponymous 
>> templates. There are probably still a couple of bugs related 
>> to that, because the way the semantics of a D program are 
>> checked does not allow to verify 100% of the time that the 
>> eponymous member(s) (yes plural) are all functions.
>
> If you like, the way sets are created is cristal-clear but the 
> way a member of the set is picked is more complex ;)

I can show you a case of overload set that's absurd. We knew 
exactly what to call. But we tought that overloads were better. 
That's when explicit overload declarations [became 
clear](https://gitlab.com/styx-lang/styx/-/commit/ed04d535f2da5c9e1c52f2d475a11b7f59584c0d). Why the heck do you need overload sets when you exactly know what has to be called 😏.

Just compile time lost. You know what to visit, just visit it ;)


More information about the Digitalmars-d mailing list