Function overloading between modules

JN 666total at wp.pl
Thu Feb 22 21:43:53 UTC 2018


On Thursday, 22 February 2018 at 21:19:12 UTC, ketmar wrote:
>
> yes. this is done so unqualified won't silently "steal" your 
> functions. this can cause some unexpected (and hard to find) 
> bugs.
>
> if you want it to work, you can either do qualified import
>
> 	import bar : foo;
>
> or manuall bring overloads from `bar` with
>
> 	alias foo = bar.foo;

I see, how about this one:

bar.d
---
void foo(T)(T t)
{
}
app.d
---
import std.stdio;
import bar;
void foo(T : string)(T t)
{
}
void main()
{
    foo(123);
};

same idea?


More information about the Digitalmars-d-learn mailing list