DIP 1030--Named Arguments--Community Review Round 1 Feedback
Jonathan Marler
johnnymarler at gmail.com
Sun Feb 9 21:45:21 UTC 2020
On Sunday, 9 February 2020 at 21:02:57 UTC, Walter Bright wrote:
> On 2/6/2020 2:59 PM, Jonathan Marler wrote:
>> How will the compiler handle function lookup if there is an
>> ambiguous match, but the ambiguous function is in another
>> module? So in your snoopy example, if one of the snoopy
>> overloads was defined in another module, is the compiler still
>> supposed to treat that as ambiguous?
>
> Please show a specific example, as your description isn't
> enough.
Here's the example I was referring to:
void snoopy(T t, int i, S s); // A
void snoopy(S s, int i = 0, T t); // B
...
snoopy(s:s, t:t, i:i); // error, ambiguous
...
I believe this one was indirectly answered here:
https://forum.dlang.org/post/xeujdoaxungjnbcsvbnf@forum.dlang.org
According to the responders there, locally defined functions take
precedence over externally defined ones. So the answer seems to
be no, it will NOT be treated as ambiguous if one of the overload
definitions is moved to another module. It seems the current
overload rules already answer this question for us.
More information about the Digitalmars-d
mailing list