On 15/01/12 10:29 PM, Philippe Sigaud wrote:
On Sun, Jan 15, 2012 at 22:19, Timon Gehr<timon.g...@gmx.ch>  wrote:

Nick:
Goddamnnit, what the fuck is wrong with me? Yes that works :)

I suspect a better error message would have prevented this.
DMD still has some potential of improvement in that area. =)

In that case, to!(Origin, Target) could be extended to deal with
to!(Origin,<empty there>).
It's been a long time since I last looked at std.conv.to, but maybe:

template to(T)
{
     T to(A...)(A args)
     {
         static if (A.length)
             return toImpl!T(args);
         else
             static assert(false, "Trying to use to!("~T.stringof~")
with no argument. What were you trying to do?");
     }
}

The compiler should be able to give you a better error message. It shouldn't be the responsibility of the programmer to provide sensible error messages when you call a function with the wrong number of arguments.

Reply via email to