[Solved] Confusing error message
drug via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 7 13:16:14 PDT 2017
07.06.2017 22:40, bachmeier пишет:
> On Wednesday, 7 June 2017 at 19:02:59 UTC, drug wrote:
>
>> How do compiler know that you want use `std.conv.to` instead of
>> _already imported_ `core.time.to`? In general it's impossible. There
>> is no way for compiler to guess that you want some other symbol from
>> out there. What if you've imported `std.conv.to` but want to use
>> `core.time.to` - what should compiler do in this case?
>> What about `writeln` - it's too different.
>
> The differences with writeln are not really relevant if we're talking
> about error messages. The compiler knows someone is calling function
> `to`. If you've already imported std.conv.to, then there's no reason to
> print anything.
Why? I have imported `std.conv.to`, but want `core.time.to` (inverted
case), what should compiler do to be a good one for newcomers?
>
> In any event, I made a second suggestion that would always work. If it
> can't find a match, it asks if you're missing an import statement, as a
> way to provide the new D programmer a hint of what to look for.
That's a good point.
More information about the Digitalmars-d-learn
mailing list