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"))


import std.datetime;
import std.conv;

auto t = Clock.currStdTime;
writeln(to!string(t));

Solves the issue but its strange that there is no error message indicating that to! needs the std.conv included. Technically one can argue that the original message mean that but its very, very unclear.
Error is right indicating that _available_ function `core.time.to` can not deduce from given types. It's impossible for compiler to know that you want use `std.conv.to` symbol. In other words compiler says that it knows only one function `to` and this function are in `core.time.` module. And this function can not be called with given args. I prefer to use selective imports and in this case compiler would say it doesn't know function `to`.

For me it's a good message.

Reply via email to