Comment Re:What's wrong with html and javascript? (Score 1) 466
Wow, you are incredibly confused. b = {}; doesn't modify b, it re-assigns b. Please learn how variables work. And if you think that "1" and true are different values, then you don't understand what a "value" is.
So you and I are obviously done here. You're either really old, used to bit-registers not complex objects, or you're really young reading text books, or you've navigated the industry by avoiding business-level programming. I've focussed on business-level programming. In this sub-industry, everything you've said simply isn't true. a==b, b==c, would never presume a==c. It's never true in real-world business, so I'd never want it to be true in business programming.
So I'll leave you with this, because it makes one angle very clear. Have you ever used perl? Perl does something interesting in this regard. Printing a reference to a variable (we'll call these objects conversationally here) never attempts to cast anything. It simply prints out the type and memory address. So a = {foo:1,bar:[123]} might be "HASH(32598763)". It actually is the memory address, but it's more than that. Because if you're numerically comparing it to another variable, it'll get cast as a number -- the memory address. In perl, using the value of a reference requires explicitly dereferencing it, making this particular issue quite straight-forward -- especially since casting is done on operators, not on values, which is awesome by the way.
Javascript does some of the same stuff, but conceals it all. Like most languages, lvalues are cast differently than rvalues. But because javascript is designed, primarily, for non-algothimic and non-scientific use, of course [] is 0. There are six versions of nothing, and whether you have nothing once or you have nothing multiple times, you still have nothing. But you've only gone half-way with your last example there. Add a numerical 0, as well as a null value, then the fun really happens. Try "0happy" too. Woah the fun you'll have!
Here's the skinny. I've been using javascript for professional profit for 17 years. I've needed to use === merely four times. Let's ignore, for the moment, how stupid javascript is in many ways, and especially in this crazy-casting way -- because it is crazy-cryptic to anyone who hasn't memorized it all, and there's always one thing that's forgotten. The real question is what would a programmer expect from string == object? Why would a programmer be comparing a string to an object in the first place?
If we're talking about a complete logic error, then I don't really care what a language does when I screw up my entire concept. If it's a convenience service, then as long as the language is consistent then I'm fine with whatever it's going to do.
Pop quiz. What do you think perl does with "5" + "information". The answer may surprise you. Here's a hint, it actually casts "information" to a number because the first three letters match a defined numerical value.