www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Error deducing function

reply Ignacious <I.D.T ProjectMaya.com> writes:
It would be EXTREMELY helpful if dmd would give a better result 
than

main.d(30): Error: template main.Do cannot deduce function from 
argument types !(1, string, int)(2, "adf"), candidates are:
main.d(6):        main.Do(int x, string y, alias Q)(int z, string 
q)

Like, which arguments actually pass and which ones fail, etc.

I know we are all suppose to be geniuses here but I flunked out 
of that class. Seems like the compiler knows where the error is 
so why can't it inform me a bit better than basically telling me 
there is an error and which lines it occurred on(cause that is 
all it really does in practice).
Jan 13
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Friday, 13 January 2017 at 22:22:12 UTC, Ignacious wrote:
 Like, which arguments actually pass and which ones fail, etc.
Yes, I agree entirely. This would be a HUGE usability bonus, far better than most the other things people work on...
Jan 13
parent reply Ignacious <I.D.T ProjectMaya.com> writes:
On Friday, 13 January 2017 at 22:57:09 UTC, Adam D. Ruppe wrote:
 On Friday, 13 January 2017 at 22:22:12 UTC, Ignacious wrote:
 Like, which arguments actually pass and which ones fail, etc.
Yes, I agree entirely. This would be a HUGE usability bonus, far better than most the other things people work on...
And it should be very simple to do. as the compiler checks the arguments it reaches the argument that it finds invalid and it simply has to calculate the length in to the string to put something like a >> in front of the argument in the error string. Or simply give the index in to the argument or template list. Probably take a good programmer less than an hour to do.
Jan 13
parent Stefan Koch <uplink.coder googlemail.com> writes:
On Friday, 13 January 2017 at 23:22:22 UTC, Ignacious wrote:
 On Friday, 13 January 2017 at 22:57:09 UTC, Adam D. Ruppe wrote:
 On Friday, 13 January 2017 at 22:22:12 UTC, Ignacious wrote:
 Like, which arguments actually pass and which ones fail, etc.
Yes, I agree entirely. This would be a HUGE usability bonus, far better than most the other things people work on...
And it should be very simple to do. as the compiler checks the arguments it reaches the argument that it finds invalid and it simply has to calculate the length in to the string to put something like a >> in front of the argument in the error string. Or simply give the index in to the argument or template list. Probably take a good programmer less than an hour to do.
Actually it's not as easy since there can be many overloads/definitions of a template and printing out additional information for the failing arguments will clutter the few even more.
Jan 22