"hijackable"/"customizable" keyword for solving the "customized algorithm" issue?

Yota via Digitalmars-d digitalmars-d at puremagic.com
Fri May 16 09:50:36 PDT 2014


On Wednesday, 14 May 2014 at 18:05:44 UTC, monarch_dodra wrote:
...
> I just had a crazy idea. "hijackable" keyword (yeah... another 
> keyword):
>
> Given a function:
> "Ret foo(T input, Args... args) @hijackable"
>
> Then, when the compiler sees:
> "foo(input, args);"
>
> It will always forward directly to T.foo if T.foo exists, 
> bypassing std.foo entirely.
...

What about stuff like this:
   import some.pkg;
   some.pkg.foo(x);

Does this still call x.foo()?  What if 'foo' is an alias for 
'bar', or vice versa?


More information about the Digitalmars-d mailing list