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];
}

module algo;

void algorithm(Range)(Range range)
{
    auto e = range.front; // Error: no property 'front' for type 'Foo'
}

module main

import foo;
import algo;

void main()
{
    algorithm(Foo());
}

--
/Jacob Carlborg
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Walter Bright via Digitalmars-d
  • Re: ADL Timon Gehr via Digitalmars-d
  • Re: ADL Walter Bright via Digitalmars-d
  • Re: ADL Manu via Digitalmars-d
  • Re: ADL Walter Bright via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Jacob Carlborg via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Jacob Carlborg via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Jacob Carlborg via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Lodovico Giaretta via Digitalmars-d
  • Re: ADL Andrei Alexandrescu via Digitalmars-d
  • Re: ADL Walter Bright via Digitalmars-d
  • [OT] local overloading (Was: Re: ADL... Timon Gehr via Digitalmars-d
  • Re: ADL Marc Schütz via Digitalmars-d
  • Re: ADL Timon Gehr via Digitalmars-d
  • Re: ADL Walter Bright via Digitalmars-d

Reply via email to