function overload on full signature?

Rob T rob at ucora.com
Wed Nov 14 09:30:53 PST 2012


On Wednesday, 14 November 2012 at 09:16:13 UTC, Walter Bright 
wrote:
>> I'm not requesting this to be a feature of D, I'm only asking 
>> why it is not
>> being done.
>
> Because types are resolved bottom-up, and if the return type 
> were part of the overloading, there would be no sensible rule 
> to determine the types.

But doesn't the compiler already have to perform overload-like 
decision making on return types in the "alias this" case, esp 
once multiple conversions are allowed?

class A{
   int i;
   bool b;
   alias i this;
   alias b this;
}

main()
{
   auto a = new A;
   int i = a;
   bool b = a;
}

--rt


More information about the Digitalmars-d mailing list