Pathological import symbol shadowing
Paul Backus
snarwin at gmail.com
Sat Nov 14 14:43:16 UTC 2020
On Saturday, 14 November 2020 at 14:13:32 UTC, Kagamin wrote:
> On Saturday, 14 November 2020 at 03:10:34 UTC, Timon Gehr wrote:
>> It should just use the standard import rules with overload
>> sets. Then the code above would just work and no hijacking
>> would be possible.
>
> You mean the code should not compile because symbols from
> different modules are in different overload sets? But then get
> from curl will always conflict with get in object, and thus
> will be unusable without renaming or FQN.
An ambiguity error only occurs if a matching function is found in
both overload sets. [1] Since std.net.curl.get and object.get
have completely different signatures, no function call will ever
match both of them, so there will be no error.
[1] https://dlang.org/spec/function.html#overload-sets
More information about the Digitalmars-d
mailing list