5 ms·
"languages like CoffeeScript, Dart, and TypeScript. These languages fail to address the single largest source of incidental complexity for any sizeable client s
by mseepgood 13y ago
"languages like CoffeeScript, Dart, and TypeScript. These languages fail to address the single largest source of incidental complexity for any sizeable client side application - concurrency."
Dart fails to address concurrency? I don't think so:
http://www.dartlang.org/docs/dart-up-and-running/contents/ch03.html#ch03-dartisolate---concurrency-with-isolates http://www.dartlang.org/docs/dart-up-and-running/contents/ch...
- swannodette 13y agoI'm not sure you actually read the post, isolates do not address the same issues at all - you can't share data between isolates and you can't put isolates onto isolates limiting coordination possibilities - all of these are possible with channels.
- mseepgood 13y agoYou can at least send a SendPort over a SendPort: "Isolates send messages using SendPorts, and receive them using ReceivePorts. The content of a message can be any of the following: * (...) * An instance of SendPort" You can prefer one or the other model, but saying that Dart fails to address concurrency is just not true.
- swannodette 13y agoI think you're taking my use of the word out of context of the whole post. I'm talking about the concurrency that is imposed by the very nature of client side programming - you have no choice. Isolates don't allow to you coordinate the concurrency that is already present.
- brandonbloom 13y agoI didn't realize Dart supports such an actor-like primitive. Neat. That said, I agree with Rich's analysis in the "Wither actors?" section of the core.async announcement: "They still couple the producer with the consumer. Yes, one can emulate or implement certain kinds of queues with actors (and, notably, people often do), but since any actor mechanism already incorporates a queue, it seems evident that queues are more primitive." See: http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html http://clojure.com/blog/2013/06/28/clojure-core-async-channe... It should be noted that actors better fit in a distributed system, which is a step above and beyond concurrent systems.
- mraleph 13y agodart:async also provides the Stream abstraction that can be compared to Clojure(Script)'s core.async channels. Libraries like dart:html and dart:io express their asynchronous APIs in terms provided by dart:async so the model is unified across the stack (e.g. HTML events are delivered through streams out of the box). Here is the first example and third examples from David's post rewritten to Dart https://gist.github.com/mraleph/5991990 https://gist.github.com/mraleph/5991990 you can see that it is not that much different from ClojureScript versions.
- swannodette 13y agoThanks for the comparison, the first example is just for fun - I'd be more far curious to see the final Rob Pike example.
- mraleph 13y agoAdded the example to the same Gist: https://gist.github.com/mraleph/5991990#file-example5-dart https://gist.github.com/mraleph/5991990#file-example5-dart
- swannodette 13y agoExcellent! Though this is precisely illustrative of what I was talking about with respect to JavaScript likely needing promises and generators for non-trivial work. Is Dart going to add sugar over both futures and streams?
- mraleph 13y agoUnfortunately I am not aware about concrete plans. I also doubt anything large will happen to the language until after 1.0 Right now there are two separate issues in the Dart's bugtracker: one for Futures https://code.google.com/p/dart/issues/detail?id=104 https://code.google.com/p/dart/issues/detail?id=104 one for Streams https://code.google.com/p/dart/issues/detail?id=7002 https://code.google.com/p/dart/issues/detail?id=7002 but none contain any details of how the syntax will look like at the end.