Tuesday, May 19, 2009

Microsoft Axum: "Erlang for .NET"

Microsoft has just started talking about a new .NET language called Axum. People have described it as "Erlang for .NET". To stick with this classification, one could also call it "Erlang with a more mainstream syntax".

It is an agent based language, which means that communication is asynchronous and message-based, and agents (cf, the Actors model) are considered active, i.e. they have their own thread or process. Data in messages is typed and can be (deeply) serialized to make remote message sending (i.e. agent distribution) possible and more or less transparent. Axum comes with integration into WCF.

Communication between agents happens via Channels. A channel is a kind of "asynchronous interface", i.e. channels define which messages can be sent into it and received from it. Agents "implement" Channels as a way of defining the kinds of messages it can handle.

Since the timing and sequencing in asynchronous applications can be hard to understand, Axum supports the definition of protocol state machines (yeah!!) for channels. So if you send something in the wrong order, you don't get a strange crash or a deadlock, but rather a meaningful error message. I *love* that part!

Axum comes with powerful operators to define dataflow networks. You can say things like: "wait until a message arrives in this channel and in that other channel, then combine the two messages in an array, forward them to the agent xyz and forward the result to these other two channels, in an alternating way". You can define things like that with concise expressions. Very cool!

Axum has a controlled way of handling side effects. Specifically, the "units of functionality" can be declared as functions, which means they have no way of accessing state (this is checked by the compiler). The point of this is, of course, to be able to run parts of dataflow networks in parallel. This is where the big benefit of agent-based/dataflow-oriented systems comes in.

I have to say, this stuff looks *really* interesting! Because it is based on the .NET platform you get interop with other .NET stuff more or less for free. There's also an integration with VisualStudio. It is really interesting to see how Microsoft, after "renovating" and "mainstreaming" Haskell to F# they now adress Erlang and pimp it up to Axum. Very cool!
I would say rather that they brought Objective Caml (OCaml) to the mainstream with F#.
Hi Marcus,

I was likewise excited by the idea of a dataflow oriented language on a mainstream platform. And Axum may turn out to fulfil that promise. Right now though, I'm not convinced. The abstractions around channels in particular seem confused; for example (quoting from the programmer's guide p6):

"when an agent implements a channel [..] it “attaches” itself to the implementing end of that channel and becomes the “server” of messages on that channel."

then a paragraph or so down:

"Channels exist to transmit messages between agents. Channels define what kind of data can go into and out of them, but unlike agents, they don’t perform any transformation of that data".

The former can easily be read as "implementing the channel" - and syntactically it looks that way too. Semantically, it ties an agent to the channel which limits the independence of both. It would seem cleaner and provide better decoupling if channels were used to link together agents without the agents having any knowledge of the channels. Channels would then be the "glue" for building aggregate networks from existing agents. In other words, channels should be the higher level abstraction. Think pipes on unix or Yourdon-style DFDs.

I'd like to hope they'll re-think this bit because there are many other appealing aspects as you say.
Post a Comment

<< Home

back to voelter.de

This is Markus Voelter's Blog. It is not intended as a replacement for my regular web site, but rather as a companion that contains ideas, thoughts and loose ends.

December 2005 / January 2006 / February 2006 / March 2006 / April 2006 / May 2006 / June 2006 / July 2006 / August 2006 / September 2006 / October 2006 / November 2006 / December 2006 / February 2007 / March 2007 / April 2007 / May 2007 / June 2007 / July 2007 / September 2007 / October 2007 / November 2007 / December 2007 / January 2008 / February 2008 / March 2008 / April 2008 / May 2008 / June 2008 / July 2008 / August 2008 / September 2008 / October 2008 / November 2008 / December 2008 / January 2009 / February 2009 / March 2009 / April 2009 / May 2009 / June 2009 / July 2009 / August 2009 / September 2009 / October 2009 / November 2009 / December 2009 / January 2010 / February 2010 / April 2010 / May 2010 / June 2010 / July 2010 / August 2010 / September 2010 / October 2010 / November 2010 / December 2010 / January 2011 / March 2011 / April 2011 / May 2011 / June 2011 / July 2011 / October 2011 / November 2011 / December 2011 / January 2012 / February 2012 / October 2012 / January 2013 /

You can get an atom feed for this blog.