Coding again at last! In Dart. Herewith are my initial experiences with Dart.
I spent an hour or two reading the “Up and Running” guide and was able to start coding immediately. The major differences in Dart from vanilla OO ala Java are optional typing and constructors. Much has already been written about the optional typing but so far I haven’t found it to be a big deal compared to simple “var” type inference. It lets you get away with things like heterogeneous arguments and duck typing but so far I haven’t needed those features. Dart’s new approach to constructors aren’t discussed as much but are a big win for me.
Dart makes object construction atomic and deterministic. Some common initialization idioms are outlawed – for example initializers can’t reference ‘this’. But it is so great not to have to deal with revealing partially constructed instances or non-deterministic class initialization order. A related feature is compile-time constant object instances with interning. There is also nice support for factory constructors. Dart’s creators are VM experts, and I think it shows in the way they have rationalized the insanity of laissez-faire construction.
The Dart Editor is a slimmed-down Eclipse with all the essentials: type-driven completion, autofix suggestions, type and doc lookup, usage-definition traversal, and refactoring. Some of it is rudimentary, but I find there is enough to get real work done without cursing. I am a little worried that analysis time is already perceivable with less than a thousand lines of code. Update: there do seem to be scaling problems in the static analyzer, but I am told they are being actively worked on. I am hoping they can fix it before I write too much code, or else IntelliJ gets their plugin working.
The one feature I wish Dart had was case classes as in Scala. These give you immutable value objects without the boilerplate hashcode and equals, and give you type-driven switch statements.
Anybody else have experiences with Dart to share?