Skip to content

jQuery error messages are excessive / counter-productive (perhaps a more general problem) #6765

Closed
@jcward

Description

@jcward

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:

selection_999 1523

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions