alias this

Rob T rob at ucora.com
Sat Dec 1 14:42:25 PST 2012


On Saturday, 1 December 2012 at 21:33:15 UTC, js.mdnq wrote:
>
> By full signature overloading I assuming you also the return 
> type?
>

Correct.

> I don't see why it is so complicated in any case since a return 
> type can just be seen as a ref argument:
>
> int myfunc()
>
> is basically the same as
>
> void myfunc(ref int returnvalue)

The compiler has to check the return type already, so effectively 
it's already able to perform full function overloading, but 
instead of allowing it, the process is designed to prevent it, 
which I think is an unfortunate artificial limitation.

Here's the thread, if you want to read all about it

function overload on full signature?
http://forum.dlang.org/thread/tmqkejkytuitqhnemizz@forum.dlang.org

Based on how the discussion went, my guess is that the problem 
has more to do with how the compiler is currently structured, 
making it more difficult than it should be, and that the D devs 
don't see enough benefit for implementing full function 
overloading at this time.

However at least some aspects of the problem will have to be 
tackled when attempting to fully implement "alias this", unless 
it's decided to keep things very limited and disallow multiple 
type conversions, but since that is something that C++ can do, I 
suspect it will at least be considered.

--rt



More information about the Digitalmars-d-learn mailing list