Description
Given: A core value of a typed language like Haxe is good compiler error messages that help the programmer quickly identify mistakes.
A simple typo in the JQuery helper function results in 32 lines of useless "overload resolution failed" error messages before simply pointing out: Unknown identifier : my_typo
I don't know technically whether there's a general way the complier could improve these situations (or whether they occur for other popular libs/externs), or if the JQuery macro / extern definitions themselves are to blame, but both are (currently) in this repo.
Thought: Would an undefined check in the macro here, before the return statement, head off all these overload resolution errors (presumably from the extern)?
Here's a sample: https://try.haxe.org/#c0a5c
import js.jquery.Helper.J;
import js.Browser.*;
class Test {
static function main() {
trace("Haxe is great!");
var my_div = document.createElement('div');
// A simple typo results in 35 lines of confusing error
// message, burying the error: Unknown identifier : my_typo
J(my_typo).css('color','#fff');
}
}
Spotting the relevant error message is harder than finding a needle in a haystack:
Activity