https://d.puremagic.com/issues/show_bug.cgi?id=12359
--- Comment #10 from Kenji Hara <[email protected]> 2014-04-06 21:40:13 PDT --- The negative effect of the implicit alias is that it makes selective imports and basic imports unexchangeable. For example: module a; auto foo(int[] ) { return 2; } module b; import a; // [A] auto foo(long[] ) { return 1; } void main() { assert(foo([1,2]) == 1); } At the line [A], the basic import makes b.foo visible, but it is hidden by b.foo. Therefore foo([1,2]) in main will call b.foo properly. Next, what's will occur if you replace `import a;` to `import a : foo`? import a : foo; // [A2] auto foo(long[] ) { return 1; } The selected a.foo is *implicitly* added in the overload set of b.foo, then foo([1,2]) will match a.foo(int[] ) more better than b.foo(long[] ), and the assertion in main will fail in runtime. I think this is much non-intuitive behavior. No one would expect the silent code breaking in module b. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
