[Solved] Confusing error message
    bachmeier via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Jun  7 11:07:20 PDT 2017
    
    
  
On Wednesday, 7 June 2017 at 14:58:26 UTC, drug wrote:
> 07.06.2017 16:27, Wulfklaue пишет:
>> Some of the dmd error messages need some tweaking.
>> 
>>> import std.datetime;
>>>
>>> auto t = Clock.currStdTime;
>>> writeln(to!string(t));
>> 
>> Result in:
>> 
>>> Error: template core.time.to cannot deduce function from 
>>> argument types !(string)(long), candidates are:
>>> C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\time.d(1709):        core.time.to(string units, T, D)(D td) if (is(_Unqual!D == TickDuration) && (units == "seconds" || units == "msecs" || units == "usecs" || units == "hnsecs" || units == "nsecs"))
[...]
> For me it's a good message.
Messages like this were an annoyance when I started out. If you 
don't import std.stdio, you get the error message
Error: 'writeln' is not defined, perhaps you need to import 
std.stdio; ?
That's a very helpful error message if you're new to D, and 
especially helpful if you're new to programming. This particular 
error is likely a common one, and adding "perhaps you need to 
import std.conv" would help a lot. Even a generic "perhaps you 
forgot an import statement" would tell new users what the error 
might be. Making it worse is that it says core.time.to but there 
was no import of core.time.
    
    
More information about the Digitalmars-d-learn
mailing list