Hacker News new | ask | show | jobs
by munificent 4370 days ago
> One big issue with JavaScript applications is that they are single threaded. Does Dart/Web Component platform provide any solution to this?

Because Dart compiles to JavaScript, we're limited in some ways in what we can do here. We do, of course, support Web Workers, but those have a bunch of constraints that make them difficult to use in practice.

We have tried to make single-threaded async programming more pleasant. In particular, Dart comes with built-in, very rich Future and Stream types. Even better, those are deeply integrated into the code libraries, including the DOM.

Every asynchronous DOM operation in Dart returns a future, which is much more pleasant to deal with than raw callbacks. Likewise, things like events are exposed as streams, so you can map and transform them like any other stream of data.

I gave a talk on Dart at Strange Loop last year[1] that talks a bit about this. Skip to around 38 minutes.

> 2. Will we see another UI rendering layer other than DOM for Dart?

Good question! There are a few different frameworks that people have built for Dart that expose their own ways of expressing UI. I think they all ultimately fall back to the DOM because that's the primitive the browser gives you, but what you as a programmer deal with may be fairly removed from that.

These days, I mostly do command-line Dart stuff, so I don't have a good lay of the land here.

[1]: http://www.infoq.com/presentations/dart-introduction