3 days ago
https://issues.dlang.org/show_bug.cgi?id=17589

Bolpat <qs.il.paperinik@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qs.il.paperinik@gmail.com

--- Comment #1 from Bolpat <qs.il.paperinik@gmail.com> ---
(In reply to timon.gehr from comment #0)
> Local imports should overload against less deeply nested imports. In this example, std.stdio.write and std.file.write should be treated as part of the same overload set within readAndLog. Otherwise, there is a hijacking risk.

You imported two `write` functions (overloaded sets) that weren't intended to be used next to each other. Call compiles in both sets, so by the spec [1], it's an ambiguous call. The spec does not say that "more local" imports shadow "less local" imports for functions. While [2] says that imports can shadow local definitions, [1] clearly says how overloaded sets are to be handled. At best, [1] is correct and at worst, the spec contradicts itself.

[1] https://dlang.org/spec/function.html#overload-sets
[2] https://dlang.org/spec/module.html#scoped_imports

TL;DR: It should be an ambiguity error, nothing else.

--
3 days ago
https://issues.dlang.org/show_bug.cgi?id=17589

--- Comment #2 from timon.gehr@gmx.ch ---
(In reply to Bolpat from comment #1)
> (In reply to timon.gehr from comment #0)
> > Local imports should overload against less deeply nested imports. In this example, std.stdio.write and std.file.write should be treated as part of the same overload set within readAndLog. Otherwise, there is a hijacking risk.
> 
> ...
> 
> TL;DR: It should be an ambiguity error, nothing else.

Yes absolutely. Reading it now, the original report was not phrased very well. std.stdio.write and std.file.write should remain in separate overload sets, but they should overload against each other so that there is an ambiguity error in this case.

--