2 ms·
I agree with this very much. Dart is a new language; JS is an existing language, improved. Dart actually has horrible semantics in places. Only if x === true w
by TazeTSchnitzel 13y ago
I agree with this very much. Dart is a new language; JS is an existing language, improved.
Dart actually has horrible semantics in places. Only if x === true will if(x) run.
- rayiner 13y agoThat's not a horrible semantic. There is one canonical truth value and everything else is false. It's the inverse of the Lisp semantic, where there is one canonical false value and everything else is true. I think it's better than the ad-hoc semantics of other scripting languages,[1] and more appropriate for a dynamic language than throwing an exception if a non-boolean is used as a predicate. [1] And as a practical matter generates faster code, because it can be implemented with a comparison against a single constant.
- dasmoth 13y agoThat's very different from Javascript (and from the untyped-language mainstream) but is it really "horrible"? The type-checker will give a very clear warning if it catches you putting a non-bool in a conditional context. And make no mistake: the type checker is an important part of the Dart development process. (One downside of this is that it does push you to working in the -- Eclipse-derived -- DartEditor, which isn't always a wonderful experience. However, the type checker is exposed and available, and there's nothing to prevent it being tightly integrated into other editors or IDEs.)