If dart wants to replace javascript it has to be better, and by a long shot. at the moment I'm just not seeing that it is
If dart wants to replace javascript it has to be better, and by a long shot. at the moment I'm just not seeing that it is
Evaluating "a == a" could return the string "potatoe" which would evaluate to false (and make no sense).
I don't see the big deal with this. If your == operator is buggy, it's buggy, no matter whether you can only return a boolean or some random other type.
(I personally found most of the criticism in the article to be in the same vein: inflammatory, superficial comments after a quick reading of the spec.)
The fact that a==a can return false isn't really the main criticism here. You could override the == operator in C++ to do that too. The article is claiming that having a literal boolean true be the only "true" value is an issue. I think I agree with this just because this code evaluating to false is out of line with every other language out there, and I haven't seen a case (yet?) that it's an improvement for any other practical purposes:
a = 1;
if(a) {
print("A is true!");
}