IMO, these two capabilities are hugely important to adaption. Even
more so than Dart's published design goal of "familiar and natural".
As far as I can tell, Dart doesn't address either of these needs at
present.
On Thu, Mar 22, 2012 at 8:19 AM, dave ford <*@smart-soft.com> wrote:IMO, these two capabilities are hugely important to adaption. Even
more so than Dart's published design goal of "familiar and natural".
As far as I can tell, Dart doesn't address either of these needs at
present.We do understand that JS interop is hugely important for Dart's success, and we're aware that the current support for it right now is pretty, uh, bare bones.We want to do better here, but we have to balance that against a couple of opposing forces.1. In a world where your browser has both a native Dart VM and a JS VM (i.e. Dartium and hopefully other browsers that add native Dart support), those two VMs will likely have their own heaps (i.e. memory), their own garbage collectors, and run on their own threads. This means that communicating from one to the other means interacting across threads and memory managers. Doing so either requires asynchrony or synchronizing the GCs.
If we add support for synchronous Dart<->JS interop, we will cut into the freedom that the VM team(s) have in how they design things. For now, we are trying to keep their options as open as possible.2. When Dart code is compiled to JS, we want to give the compiler as much freedom as possible in the code it generates. In particular, it may mangle names (i.e. rename your identifiers to handle name collisions or deal with differences between JS and Dart) and it will tree shake. Tree shaking means the compiler doesn't generate JS for Dart code that you don't call.
1)
I would accept and maybe wish that the interaction between Javascript
and Dart
is based on asynchronous message passing.
I want Dart to be different; otherwise I would still use Javascript.
I want Dart to enable concurrent activity.
I want Dart to have the fastest and cleanest implementation possible.
I want Dart to evolve swiftly without W3C or Ecma brakes; at least for
now.
Probably a seamless interaction between Javascript and Dart makes it
impossible to simply plugin the Dart reference implementation in another browser.
Although plugins are no more politically correct anyway.
Unfortunately the high level W3C HTML + JS mix replaces a simpler
lower level API that
would offer true freedom by allowing binaries, including Dart, to be
used as browser plugin.
2)
The biggest showstoppers of Javascript and Dart is the absence of the
distinction
and protection of a public and private API and implementation of my
web application.
Web 2.0 applications are just about presentation, i.e. text, pictures,
colors,...
There is not much reason to copy or protect it except for or against
pishing.
But the Web 3.0, should it ever come, will be an operating system for
complex applications
that nobody wants to get stolen or copied on the client or browser
side.
For now I see not much reason to prefer Dart to Javascript for
unprotected and hence simple Web 2.0 browser side applications.
Calling Dart from JavaScript and visa-versa
Calling Dart from JavaScript and visa-versaAny updates on this front since may?
--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
Hi Dave,We've been working on the low-level plumbing for this. We've added support for synchronous calls between JS and Dart. You can see some examples in our tests:Dart to JavaScript:JavaScript to Dart:
Currently, there are limitations on argument and return types - essentially they must be serializable data. We're looking at proxying of objects and functions as well.
Cheers,
Vijay