On 2/4/13 3:01 AM, Jacob Carlborg wrote:
On 2013-02-04 06:20, Andrei Alexandrescu wrote:

void delegate(string) dg = &s.foo;

I know that this expression works. But since this works, why can't we
overload on the return value. This seems to be do exactly this. The
arguments I heard against overloading on the return value is due the LHS
of an expression shouldn't affect the RHS.

I think overloading on the return value of functions can be made to work. I understand how it makes it more difficult on the side of the compiler writer, but it's not impossible. The main argument against it is that it adds yet another layer of difficulty in name resolution for function calls.

Andrei

Reply via email to