ADL

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 04:16:47 PDT 2016


On 9/3/2016 3:51 AM, Timon Gehr wrote:
>> I don't think it is a template issue. It's a name lookup issue.
> It's both. ADL is mostly useless outside of generic code.

It was initially justified as a solution for operator overloading, which has no 
necessary relationship to templates or generic programming.


> It's mostly about how
> templates specify what interface they require and how the requirements are
> satisfied by the caller. ADL is a workaround for the lack of a convenient enough
> such protocol in templates. Other approaches to generics solve this particular
> issue quite elegantly. (E.g. type classes implicitly pass along the required
> free-function functionality.) D's templates don't, this is why it is a template
> issue.
>
> By default, name lookup does not work in a way that would allow you to actually
> extend types using UFCS, and therefore none of Phobos works that way.

Lambdas!

(Besides, I showed how other scopes can be imported based on a type, and then 
things can be looked up in those scopes, and UFCS applied.)


>> There's LINQ in C#, for example.
> C# does not have templates.

It has generics:

   https://msdn.microsoft.com/en-us/library/512aeb7t.aspx

and iterators and algorithms and LINQ.


More information about the Digitalmars-d mailing list