Overloading property vs. non-property

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jul 17 11:55:48 PDT 2010


On 07/17/2010 01:14 PM, Robert Jacques wrote:
> I'm also hopeful for Functions-as-methods, although you may be borrowing
> trouble with your example. It appears that templates are not included in
> T.init's scope as the following compiles:
>
> struct Bar {
> void foo(T)() if (!is(bar.foo!int)) { writeln("recursive"); }
> }
>
> void foo( T)(T x) if (!is(T.init.foo())) { writeln("recursive"); }
> void foo2(T)(T x) if (!is(T.init.foo())) { writeln("recursive"); }

Well it's not that the symbol is not included, it's that the expression 
doesn't compile. You should write is(T.init.foo!Something()) to see foo 
inside T.

Andrei


More information about the Digitalmars-d mailing list