NumGuess Google Dart implementation

Dart is Google’s new programming language created in an attempt to replace JavaScript as the de-facto programming language of the web. It provides useful features from strongly typed languages as well as preserving the flexibility of JS.

With the stable version released just over a month ago, its success is still questionable, receiveing criticism from many sources. Apart from a development version of Chromium, currently there are no browsers on the market that includes (or plans to include) a Dart VM. Thanks to dart2js which cross-compiles Dart programs to JavaScript that works on all current browsers, you are free to have a look and see if it is of interest to you.

In my experience calling it a stable release is a bit bold, I couldn’t start its Eclipse-based editor and only received cryptic error messages with little to no indication of what the actual problem is. Putting the path for different JDK versions in the config file did not solve the problem, it just rewarded me with different errors which made no sense. Note that my machine has everything it needs for Android development and never had an issue with anything Java related. After a bit of struggle, I decided to just use the command line tool directly.

Even if the language itself has a long way to go to gain wide adoption, it is another nice candidate to write a NumGuess version for it as a console program. All IO operations are asynchronous in Dart, the program itself should have been most similar to the jQuery wrapper version, however I ran into problems when trying to register different listeners to the standard input stream. I settled with a single function to listen to all input from the console, which ironically made the program most similar to the recently added AWK version, with a special variable to track the program’s state.

Head over to the GitHub repo if you’re curious how the Dart version works.

Share Button
Tagged with: , ,
0 comments on “NumGuess Google Dart implementation
1 Pings/Trackbacks for "NumGuess Google Dart implementation"
  1. […] just optimised the code for speed tests remains to be seen. I’m happy to report that the NumGuess Dart version is still working as intended, although as they’re submitting the language for standardisation […]

Leave a Reply