ADL

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 5 06:28:47 PDT 2016


On 9/5/16 11:25 AM, Jacob Carlborg wrote:
> On 2016-09-05 11:06, Andrei Alexandrescu wrote:
>
>> That is correct (and btw the example should use the member call syntax).
>> But touching a type's module is modifying the type. -- Andrei
>
> Not sure what that has to do with anything.
>
> Example:
>
> module foo;
>
> struct Foo
> {
>     int[] array = [1];
> }
>
> int front(Foo foo)
> {
>     return foo.array[0];
> }

Yah, make front a member please. It's in the same module so you're not 
breaking any encapsulation anyway. -- Andrei



More information about the Digitalmars-d mailing list