The downside is that as of writing this no browser natively supports Dart, not even Chrome. You can, however, try the language using the so-called Dartboard program at the Dart homepage. It is basically a Dart interpreter written with JavaScript. Note that currently it only works in Chrome and Firefox!
To test the new language I wrote the 99 Bottles of Beer song in Dart. The link will take you to Dartboard where you can try the program yourself. The program uses the neat one line syntax for getters, one setter (using which looks just like using a regular public variable!), a class with a constructor with one required and one optional parameter, a method with an optional parameter and also an exception is thrown when the wall runs out of bottles.
After writing this program and submitting it to The 99 Bottles of Beer Website I searched Twitter for other versions of the song in Dart and indeed found one from some Japanese blog. That version of the song is somewhat different to mine and nice too, but fails to follow the lyrics in the end.
So anyway, Dart looks nice and easy to learn. It looks like everything that JavaScript should have been in the first place. We'll see when Chrome gets support for it and whether other browsers decide to start supporting it as well. Unfortunately some people apparently tend to use old browser versions for ages, so Dart won't overtake JavaScript any time soon.
Ei kommentteja:
Lähetä kommentti