Dart is on Chromium - and Dart meets Scala

By on

Today  there were two good news in my inbox. First, a Chromium branch has arrived with the integrated Multi-VM which has been proposed to WebKit! It was only a matter of time this happens. For now you need to build this browser yourself. At the moment the build is tested on Mac OS X and Linux - be aware, there were no security tests so far, use at own risk. What is it actually? A browser which supports native Dart and therefore can run the new script type "application/dart", like this:

<html>
  <body>
    <script type="application/dart">
      #import('dart:dom');
      void main() {
         final element = window.document.createElement('div');
         element.innerHTML = 'Hello from Dart';
         window.document.body.appendChild(element);
      }
    </script>
  </body>
</html>

This script creates a new div Element, writes some text in it and appends it to the documents body. Native - no JavaScript anymore.

Dart meets Scala

On a second note, Amin Shali created a framework which is similar to "Actors" in Scala. At the moment it does not work with JavaScript Generation and is meant for use in the VM only (commandline, guys). He even wrote some examples.

This frameworks relies on top of Darts Isolates - the way for concurrency in Dart. Looking at it, this framework is a great way to use Isolates without the low level pain :-)

class HelloWorld extends Actor {
  HelloWorld() : super() {
    on["say hello"] = (var who) {
      ui.print("Hello ${who}!");
      halt();
    };
  }
}

As you can imagine, if you send the "say hello" command to this Actor, the parameter is printed. Some more classes are needed to bring this to fly, like the ActorManager, which creates these Actors. Stay tuned for a blog post on this one!

Tags: Dart