ADL

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 22:57:52 PDT 2016


On Sunday, 4 September 2016 at 01:34:47 UTC, Walter Bright wrote:
> On 9/3/2016 5:36 PM, Timon Gehr wrote:
>> Does not work. Local overloads are not supported.
>
> Yeah, you're right, should have tested that:
>
>   void abc(int);
>   void def(uint);
>
>   void foo()
>   {
>     alias func = abc;
>     alias func = def; // error
>
>       func(1);
>   }
>
> fails. Pushing it out a level works:
>
>   void abc(int);
>   void def(uint);
>
>   template foo()
>   {
>     alias func = abc;
>     alias func = def;
>
>     void foo()
>     {
>         func(1);
>     }
>   }
>
>   void main()
>   {
>     foo();
>   }

What do you think about making overloading and UFCS work with 
local symbols? There are workarounds, but nothing pretty.


More information about the Digitalmars-d mailing list