[Solved] Confusing error message
bachmeier via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 7 12:40:05 PDT 2017
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.
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.
More information about the Digitalmars-d-learn
mailing list