4 ms·
If you are looking for a structured language (for front end dev), Typescript is a better alternative imho. Javascript devs can still read it and it's compatible
by camus2 13y ago
If you are looking for a structured language (for front end dev), Typescript is a better alternative imho. Javascript devs can still read it and it's compatible with any JS library out there.
Dart not so much since the semantics are different.You can still interact with JS libs but it's not as straight foward as TS.
I tested a number of options (GWT,Haxe,CS,Dart,Opal,Jsx,...),while i'm not a Microsoft fan(by a long shot),Typescript is the solution that allows the best integration with legacy code and pure JS libraries,while making easy to port old java/C#/as3 code to JS.
- Flow 13y agoThat the semantics are different from Javascript is one of the big selling points of Dart. :)
- michaelwww 13y agoI've done a project in Dart and another in TypeScript and like them both a lot more than doing straight JavaScript. I appreciate the optional type checking in both and the IDE support that each enables. TypeScript is appropriate if your project is more quickly completed with existing libraries like jQuery UI and needs to run on older browsers. Dart is appropriate if you don't need to use older established JS libs and IE9 and above are your target requirements. I like having them both in the toolbox, but I prefer Dart slightly more than TypeScript for various reasons.
- TazeTSchnitzel 13y agoI 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.)