My thoughts on Dart and JavaScript

Maybe you've heard about Google Dart, a programming language which Google would like to replace JavaScript with. It has been taken a bit under fire, since a user posted what a simple "hello world" program in Dart looks like when compiled down to JavaScript. It results in a horrible, incredible long piece of code, choked out by the Dart compiler.
So Dart appears not to be a nice replacement for JavaScript, but honestly: why a new programming language at all? This has been tried numerous times before. We all know, JavaScript has it's problems. But why don't we just provide a simple VM for scripting in the browser? In that way, you could write your website code in any language you would like. Why forcing web developers to use a specific language at all? Also, if we only provided bytecode to the browser instead of scripts, it would actually make websites faster. They would load faster, be able leave out the part where they would parse the code, and be able to optimize the execution of the bytecode much easier. Wouldn't that be an idea?

ten comments, already:

thats smart man talking, browser devs should listen to this..
rndbit - 12 10 11 - 16:17

This is already done – NaCl. You provide browser LLVM bytecode. It executes/JITs it in good performance native code.

If you really want – you can make almost any language to compile to LLVM bytecode.
martinsm () - 12 10 11 - 16:42

I must say I love JavaScript. I first thought it was a small limited scripting language, which it was, then had to spend some time with it in the Web 2.0 time-frame and fell in love with it: syntax is clean, language is very powerful, flexible, readable, it gets enhanced, it is a standard (almost) followed by all web-browsers, libraries are amazing and it can already do so much, from basic form validation to server side, through 3d animation…

Intel thinks so too and starts working to provide faster JavaScript: http://games.slashdot.org/story/11/09/16..

The limitation of not being compiled can be overcome by using tools such as JSLint or the Google Closure compiler.

I really do not understand the need for another language and Google is clearly making a mistake here with Dart.
John - 12 10 11 - 17:22

I agree completely. It is silly to send raw source code to the user. Instead, the standard should be some sort of bytecode format. There is no reason for the browser to know anything about the language used.
Graeme () (link) - 12 10 11 - 17:44

just because the Dart compiler sucks right now doesnt mean it cant be improved. Dart is still very much work in progress. also, if it were to replace javascript, there’d be no reason to compile it into javascript…

i’m no expert but i hear the problem with using bytecode for websites is that the vm would be optimized for specific kinds of languages, so you’d either have a vm that’s good for static languages or one that’s good for dynamic ones. im sure its not even that simple.

there were people thinking about simply sticking the CLR into browsers. that’s already a standard and it’s not so bad. would be better for static languages though, i think.
Matthias - 12 10 11 - 20:36

VM in a browser is actually one of the primary reasons Dart exists. While they haven’t yet released the VM for Chrome, it is coming.

Dart to JavaScript is for legacy compatibility with browsers that won’t implement a VM for political reasons.

It is nearly impossible to get all of the people in the W3C standards body to make even minor changes to JavaScript—getting them to go for an entirely new VM would never fly, there is way too much political inertia.

Dart is Google’s response to this problem… implement a VM, put a language that can compile to JavaScript on top of it for non-Chrome browsers, and hope that enough people adopt this language that other browser manufactures are pressured into implementing the Dart VM (which they’ve released under OSS and a liberal free patent use grant) directly into their own browsers.
george mcbay - 12 10 11 - 22:25

From my experience with JavaScript I can say that it has improved a lot in the past years. When I started it was really hard to write code that runs correctly on both Firefox (or was it Netscape??) and the Internet Explorer, but this has become much better, especially with things like jQuery.
Brainsaw (link) - 13 10 11 - 07:53

The problem is, that everybody seems to know how to make it best. Microsoft has ideas, Google and Mozilla too and everybody has its very own way to implement it.
KIENI - 13 10 11 - 14:28

Isn’t this what Java applets, activex, silverlight and Flash try doing?
juantar - 13 10 11 - 23:27

I would think that eventually you can use Dart for your Desktop, Web and Mobile stuff. So that eventually you do not have to use Java for Android Programming but Dart. So there might be native Chrome/Android Bytecode Dart support and maybe some other Browsers will pick it up, too.
Jan () - 14 10 11 - 19:28


Name:  
Remember personal info?
yes
no
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.