masking of module-level functions with local imports

Jesse Phillips via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 9 10:44:59 PDT 2015


On Friday, 9 October 2015 at 03:52:10 UTC, Steven Schveighoffer 
wrote:
> I have to say, this doesn't seem right. What I want when I 
> import inside a local scope is to treat all code in that scope 
> as if I *had* imported that module at module level.
>
> I realize changing this would mean that existing code would 
> break. But what this does, effectively, is destroy any 
> possibility to overload functions across modules reliably.

Agreed. I filed the report incorrectly against DMD as I expected 
local imports to follow the same overload resolution with the 
outer import counter parts.

Note that had Druntime's new 'to' function accepted strings it 
would have hijacked the call (no compiler error).


More information about the Digitalmars-d mailing list