47 points · by WoodenChair · 12y ago · 59 comments
It was marketed as faster, however in reality it's slower on everything except a special build of Chrome.
It supposed to make us more productive, however all it does is that it makes churning out code easier at the expense of debugging. Sourcemaps are here to solve these issues, however since Dart is not a purely transpiled language, I don't really see that working out.
In my opinion Dart is an excellent research project, but it ultimately fails at fixing anything that makes client side web development hard.
- optional static type annotations
- advanced object-oriented features (mixins, advanced constructors, etc)
- rich built-in libraries
- pub package manager
- 2X V8 performance w/ the Dart VM
- integrated tooling
- exceptions
- generics
- operator overloading...
I could go on, but basically I'm not sure what language you were looking at because Dart has a lot that plain vanilla JavaScript does not (although can have with extensions). It also doesn't inherit all of those flaws JavaScript got from being designed in a time crunch (10 days is really not enough time to design a language).
If I had to pick one though, it would probably be the fact that Dart is a platform (rich language, libraries, tools, and package manager) rather than hodge podge of frameworks on top of a lightweight language.
I suspect that experience has shied people away from the idea of relying on a single-vendor platform for web apps. We tried "rich Internet applications" and they weren't a lasting solution; both Adobe and Microsoft gave up on their efforts.
Google's solution has a plain-JS fallback which Flex and Silverlight couldn't do, but otherwise the Dart world view seems similar: one vendor, one monolithic platform, one preferred runtime.
- It compiles to JS (you mentioned this)
- It is standardized by ECMA
- The entire platform (VM, compiler, libraries, IDE, etc) is open source
I guess how you feel about Dart may depend on how you feel about Google and big corporations more generally. Just because a big company that has a lot of mindshare/marketshare creates a great platform, does that necessarily mean we should be afraid of it? Maybe, but if you're frustrated by JavaScript, it's certainly worth a look.
Performance - Dart has its own VM which runs independently (on the server, or in special builds of Chrome, but soon to be mainline Chrome). So it's not just a language that trans-compiles to JavaScript, it's also a language with its own independent high performance VM that you can use on the server today and the browser tomorrow (hopefully). By the way the Dart VM was written by the same guys that created V8 - generally considered to be one of the highest performance JavaScript VMs - so I think we can believe them when they say it's higher performing.
Rich Built-in Libraries - Just take a look here: https://api.dartlang.org/ There's everything from a reflections API to a WebGL library. There's JavaScript interop libraries, concurrency libraries, and the equivalent of jQuery built-in. That's just scratching the surface.
Integrated Tooling - Dart has its own package manager (pub) which is quite nice as well as its own IDE (Dart Editor) which comes with a debugger, profiler, and all the niceties you'd expect (code completion, deployment help, etc).
It's also a new language (less than a year since 1.0) backed by a big company so these things are only going to continue to improve.
That makes no sense whatsoever. As evidence, I submit that Haskell can be compiled to C (and to javascript these days).
As it is, it is just another language that transpiles to JavaScript.
The advantage is that (1) on Chrome, you get better performance, and (2) you get a nicer language that Javascript.
Ideally in the future the Dart team will be more on top of things, but you will still have to recompile your Dart applications every time a new browser comes out. Many developers will probably not remember to do this - if they're maintaining their apps at all.
Dart2js is also an afterthought (in general) compared to the mainline dart vm, so it will be possible (if not common) for dart applications to end up only being compatible with Chrome's implementation. One of the main issues I'm aware of in this area is that integers larger than 53-bit will silently fail to work correctly, while native Dart will handle them.
TypeScript comes close with the tool support, but it doesn't have the unsurprising semantics, and all in all it's a lot more limited, because it's designed to be a near-superset of JavaScript.
I'd be using Dart already if it was simpler to integrate with existing JS libraries. That's the part TypeScript got way better.
Tool support must be one of the most underrated language features these days. The enormity of blog posts about desiging your ruby code for "greppability" is just scary - I just want my tool to generate a call hierarchy for me, thank you. Dart has this covered.
It even has doesNotUnderstand:, so it's quite extensible.
The optional typing is neat: you can have a type error and the program won't just compile, it will continue to run! There's a video of Gilad demonstrating this in a live coding environment: he changes the type of a variable that's a number to String and apart from the compiler now complaining, nothing changes.
The isolates concept also seems well-thought out, with separate heaps and the only interaction via messaging. Nothing breathtakingly new, but I think they picked up the right thing and implemented it well.
The fact that the semantics are sane means the compiler can create faster code than JS with fewer heroics (if it isn't compiled via JS).
I'd like to do a few personal projects with server-side scripting and I need to learn a new language and ecosystem for it. From what I've seen I'd rather learn Dart because it is more familiar to me. What's been stopping me from doing that is missing integration and/or documentation in asset compilation toolchains for example in Play (i.e. no sbt-web plugin).
Client side development is, ironically, somewhat more complex because of the lack of module standard. You'll almost certainly want to use require() in the browser, but that won't work without taking extra, confusing steps. 'Browserify' pre-processes your JavaScript, generating a single large bundle, but that introduces complexity both at build- and run-time. And that doesn't even address the ongoing saga of the lack of a module standard for the browser.
By contrast, writing simple programs or servers in Node is vastly more enjoyable than in Java.
Please remember to recompile all your apps you deployed with Dart < 1.6. There are still some Firefox users out there. (Majority in Germany uses Firefox.)
For example, compare Ember and Angular; Ember's architecture records the dependencies between values, and only updates what needs to be updated when an upstream dependency changes, while Angular has to recompute everything on every 'digest' cycle. When it comes to writing directives in a complex Angular application, you often to set a numerical priority field to the just the right number to get things to happen in proper order - leading to spaghetti code that is hard to reason about and fragile to extend.
I think Dart is even worse when compared to better emerging options like ghcjs (which compiles Haskell to JavaScript) and Elm; these alternatives have more powerful type systems that make common patterns like reactive programming and generic programming much easier and safer. Control structures that are built into Dart (e.g. the 'async' feature) can be treated as just one instance of a general type class (e.g. Monad) with ghcjs.
I think everything considered, these highly promoted and usually highly adopted but technically inferior Google front-end technologies are actually a net negative for the web.
also another question : does anyone here using angulardart can talk about how much static type anotation helps ? i'm thinking of future<t> instead of $q and directive writing ( which i always found a bit confusing, so maybe types help).
https://github.com/lvivski/start
There's also a Dart specific hosting service that's in beta: http://www.dartvoid.com
And there's been some success running Dart on Google Compute Engine through App Engine Managed VM (not sure if this is out of beta).