My thoughts on Dart and JavaScript

Posted on:October 12 2011

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?


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

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.
2011-10-12 16:42:00

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:

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.
2011-10-12 17:22:00

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.
2011-10-12 17:44:00

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.
2011-10-12 20:36:00

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
2011-10-12 22:25:00

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.
2011-10-13 07:53:00

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.
2011-10-13 14:28:00

Isn't this what Java applets, activex, silverlight and Flash try doing?
2011-10-13 23:27:00

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.
2011-10-14 19:28:00

Add comment:

Posted by:

Enter the missing letter in: "I?ternational"




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]