ADL

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 05:52:53 PDT 2016


On 9/3/16 3:09 AM, Walter Bright wrote:
[snip]

What would be really nice is to allow ADL easily and without fuss when 
needed. On Manu's example:

module bob;
struct S {}
void f(S s);

module joe;
struct T {}
void f(T t);

module myalgorithm;
void test(T)(T t)
{
   mixin(adl!(T, "f"));
   f(t);
}

So adl!(T, "f") expands to an import of f from T's module if it defines 
a function f, or nothing if it doesn't.

Generally I agree that there's more upside to not introducing ADL for D.


Andrei



More information about the Digitalmars-d mailing list