Dart aims at the Web
Posted by Dion Almaer about a year ago on dart google javascript jsvm
Google has officially shown us Dart, unveiling a “technical preview” at the awesome GOTOCON in Aarhus.
Lars Bak posted the following as he got on stage:
Today we are introducing an early preview of Dart, a class-based optionally typed programming language for building web applications. Dart’s design goals are:
Create a structured yet flexible language for web programming.
Make Dart feel familiar and natural to programmers and thus easy to learn.
Ensure that Dart delivers high performance on all modern web browsers and environments ranging from small handheld devices to server-side execution. Dart targets a wide range of development scenarios: from a one-person project without much structure to a large-scale project needing formal types in the code to state programmer intent. To support this wide range of projects, Dart has optional types; this means you can start coding without types and add them later as needed. We believe Dart will be great for writing large web applications.
Dart code can be executed in two different ways: either on a native virtual machine or on top of a JavaScript engine by using a compiler that translates Dart code to JavaScript. This means you can write a web application in Dart and have it compiled and run on any modern browser. The Dart VM is not currently integrated in Chrome but we plan to explore this option.
The language comes with a set of basic libraries and tools for checking, compiling, and running Dart code, all of which will evolve further with your participation. We’ve made the language and preliminary tools available as open source on dartlang.org.
From the talk itself, he and Gilad tell us:
- You can run Dart via a native VM or via compiling to JS. This to be is the big news. If this could get real deployment, then the hook is in…. but the backup makes it viable? :/
- We are not targeting JavaScript, but rather “fragmented mobile platforms”
- Dart has *no* primitive types
- No type errors, just warnings… “you’re innocent until proven guilty”
- Kasper Lund and Lars Bak (v8ers) worked on a proof of concept language called Spot
- Single-threaded
- main()? ugh
- Dart has isolates (actor model) and they can run remotely
- Named constructors: Greeter.withPrefix(this.prefix); var greeter = new Greeter.withPrefix(‘Howdy,’);
- This really does look like GWT…. Java-esque look + DOM/Webby content
- Eclipse-based tool was shown. Fine and all, but was hoping for something really special on the tooling side. We so badly need help there!
- Dart doesn’t currently support require (node/commonjs world), and you instead #import etc.
- “Heavy” isolates point to mapping to threads in the future
- It is fun to look at things (and learn) such as code reviews
- This is just me, but I much favor git clone from GitHub vs. gclient config
If I look at the language itself it looks more like C than JavaScript. This isn’t a good thing. I come from the world of Ruby. I enjoy CoffeeScript (CoffeeScript for Dart coming in 5, 4, 3, 2, ….). I understand that they wanted the language to look “very familiar” but meh. This is a language that I don’t think I would enjoy creating with. To see if you would, take a look at some of the fuller samples, as that is what your code will look like. The VM could be a whole other ball of wax. I am sure that side of things is great. I am sure the type system is great.
I have to admit, I was a little skeptical when I heard that this was first coming from Lars (as amazing as he is). He doesn’t write Web applications. He builds VMs. I was more hopeful when I heard that Gilad was in the game, but even there, has he written a large Web application? This feels like it needs more Alex Russell. (NOTE: I have no idea the scope of the team behind this… I am sure there are a bunch of Web folk… oh, wow, 66 folks are listed as owners + commiters!)
I fear that Dart has been built from an efficiency model upwards. That is fantastic. I personally prefer a platform that delights the developer and goes for developer happiness first. This is why I liked Ruby even when the runtime sucked.
In many ways I actually prefer the Objective-C trade-offs. There you have a high level language that is very different, but you can drop down to C if you need too. With ARC you aren’t in garbage collection land, but close…. and you don’t have to worry about the collection spikes harming your UI.
All together, feeling a little ‘meh’… but, still good to try new things and see what blossoms! What do you think?