Isn't what you're describing here basically equivalent to saying JS should throw on invalid comparisons, with
try {if (x) then A else B} catch C
rewritten as if (x) then A else B otherwise C
?But WHY are you trying to compare them? The fact that one of these variables is a field called LENGTH is highly suggestive of some particular semantics that you intend these variables to have.
> there's a dozen different ways where that comparison could involve type coercion
That's right, which is the reason I can't answer your question as you posed it.
I predict that if you try to fill in the details what you will find is that you will be unable to do so in any way that does not reveal the presence of something badly wrong in your design.
> The "third boolean" value is useless unless you completely redesign the language.
You have to add an OTHERWISE clause to the IF statement and change the semantics of some operators. That's not a "complete redesign."
Interesting way of expressing the result of an ill-defined operation. Or am I off base?
But in the absence of this information, my first guess would be: