The worst overload system that actualy works

Basile B. b2.temp at gmx.com
Mon Dec 21 16:59:21 UTC 2020


On Monday, 21 December 2020 at 16:48:27 UTC, Timon Gehr wrote:
> On 21.12.20 14:35, Basile B. wrote:
>> Overloads can be confusing because of implict conversions and 
>> promotion rules.
>> So here are the explicit overloads[1]. Note that there is no 
>> plan to propose this for D ;)... destroy.
>> ...
>
> Proposing this for D would not do much. This is already in D:
>
> void createFromBytes(ubyte[] values) {}
> void createFromFile(string name)     {}
>
> alias create = createFromBytes;
> alias create = createFromFile;
>
> void main(){
>     const string name = "test.txt";
>     create(name); // calls createFromFile
> }
>
> :P

yeah but I think the way the overloads are tried is different.


More information about the Digitalmars-d mailing list