ADL
ZombineDev via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 3 06:22:38 PDT 2016
On Saturday, 3 September 2016 at 10:33:22 UTC, Walter Bright
wrote:
> On 9/3/2016 3:14 AM, Timon Gehr wrote:
>> On 03.09.2016 10:37, Walter Bright wrote:
>>> None of the algorithms used in std.algorithm or elsewhere in
>>> Phobos have
>>> this particular issue.
>>
>> Yes they do. It is not possible to implement the range
>> functions as non-members.
>
> It's done for arrays via std.array.
>
>
>>> Nor have I seen ADL supported in any other
>>> language, despite many supporting generic algorithms.
>>
>> Which other such languages have templates like D or C++?
>
> I don't think it is a template issue. It's a name lookup issue.
> There's LINQ in C#, for example.
I agree that it's not a template issue. It's more of a modules vs
namespaces issue. I think the lack of ADL is not a problem in C#
because everyone can (and everyone does) extend an existing
namespace, so most user's of LINQ algorithms just slap a `using
System.Linq` on top of the file without caring in exactly which
file the functionality they're using is coming from.
Personally I'm glad that D doesn't have ADL because ADL can make
it very hard to find which overload is called.
More information about the Digitalmars-d
mailing list