The worst overload system that actualy works

Timon Gehr timon.gehr at gmx.ch
Mon Dec 21 16:48:27 UTC 2020


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


More information about the Digitalmars-d mailing list