I have mixed feelings on the new languages that compile to JavaScript such as Dart and CoffeeScript. The problem with these languages is that by producing JavaScript there are people who seem to think they are creating JavaScript projects when they are not. It is possible to take the JavaScript output and edit it as if it were a JavaScript program, but unless those changes are also done in the language source code, those changes are either not part of the project or make the project much harder to maintain. This effectively means that once you start a project in one of these languages you pretty much have to stick with the language. This is not necessarily a bad thing but it does reduce the number of people who can use the source code.
Dart is a bit different from other languages that compile to JavaScript. The compiling to JavaScript is a backwards-compatibility feature designed to allow programs written in Dart to work on browsers that do not support the Dart language. The idea is that eventually browsers will start supporting Dart as one of their script-tag languages. The dart programs then would be run using their native JIT-compiler resulting in better performance. Right now there are not any browsers that support Dart, but Chrome is going to soon as the Dart SDK includes a beta-build of Chrome that has Dart support.
When Dart was first released, I briefly looked at the language but decided I would wait for the 1.0 release before trying it. A Google IO presentation on the language got my curiosity peaked and when I discovered StageXL (which like the CreateJS library is modelled after the Flash API that I am familiar with) I decided that the JavaScript issues I was having with CreateJS might be solved if I used Dart and StageXL. This in fact was the case so I have decided that I will be using Dart to port my Ultimate Retro Project to HTML5.
The Dart language is a proper Object-Oriented language with optional type support. All the type-related issues I have with JavaScript are gone and having proper classes makes working with code great. My favourite feature surprisingly was the switch statement. Dart requires that each case statement within the switch block has a break, continue or return statement making the issue of accidentally forgetting a break statement a thing of the past. This is one of my pet-peeves with all the C-like languages so discovering this feature made my day.
While I am still new to the Dart language, I suspect that by the end of the Ultimate Retro Project port I will be close to an expert with Dart. If like me you are coming to JavaScript from real programming languages, Dart may be the solution. I will be continuing my discussion of Dart as I continue to work on my port, but as this is a side project I am not sure how quick the work will proceed. Perhaps by the end of the project I will have changed my mind, but my current impressions of Dart are exceedingly positive so there will have to be major issues to make me change my mind about the language.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment