ADL

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 13:12:40 PDT 2016


On 9/5/16 4:41 PM, Jacob Carlborg wrote:
> On 2016-09-05 15:28, Andrei Alexandrescu wrote:
>
>> Yah, make front a member please. It's in the same module so you're not
>> breaking any encapsulation anyway. -- Andrei
>
> I just said:
>
> "I thought one of the reasons for UFCS was to be able to make a type
> support the range interface without modifying the type" [1].
>
> And you replied:
>
> "That is correct" [2].
>
> And now you're saying that it should be a member?

That's the path of last resistance.

> What if it's in the
> different module?

D does not support one module to expand a type defined in another module 
with 100% transparency.

> Or as it is for the built-in arrays, not possible to
> add a member there.

That pattern is only possible with the restrictions and limitations of 
std.array.



Andrei


More information about the Digitalmars-d mailing list