Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼


Fan: A Portable Language Is Bringing Actors to JavaScript

Fan, another new programming language developed in the multicore era, has recently launched its 1.0.45 release. It is a very active open source project with a very interesting approach to many modern concurrent programming challenges.

I began writing this post about Fan 1.0.44 a week ago. Now, Fan has a new version, 1.0.45.

Most developers don't want to learn a new programming language. However, Fan is a very attractive language for certain tasks because it is trying to solve many modern problems related to concurrency and multicore programming.

Fan is both an object-oriented and functional programming language. This means that a developer can combine functional programming code with object-oriented code. However, at the same time, it has built-in immutability, message passing, and REST-oriented transactional memory. It uses Java-style syntax. Therefore, Java and C# developers won't have problems to understand Fan code.

Its portability makes Fan almost unique. So far, it can run over the JVM (Java Virtual Machine), the .Net CLR (Common Language Run-time) and JavaScript. Its JavaScript support is one of the most exciting features I've found for this language. There are many other languages and libraries offering actors and many different concurrency models for the JVM and the .Net CLR. However, Fan's support for JavaScript could revolution the scripting performance. Scripting could take advantage of multicore.

However, the aforementioned sentence isn't right. Scripting should take advantage of multicore. Fan is evolving to offer JavaScript developers the possibility to tackle concurrency using actors and message passing features. Besides, you can also run it on the JVM or on the .Net CLR. However, you can expect Fan to offer additional compilers to run on new platforms. Portability is very important for Fan.

Fan creators talk about the productivity of Ruby with the performance of Java. Fan's performance is really interesting. As it offers the possibility to tackle multicore, developers can transform a slow performance language into a fast performance one. Undoubtedly, JavaScript's support is a great opportunity for developers to create higher performance RIAs (Rich Internet Applications) based on this popular scripting language.

It's a bit difficult to find a definition for Fan, because it tries to offer many different features in one single and simple language. In a few lines, this list offers a summary of Fan's main features:

  • Portability.
  • Object-oriented (with inheritance support).
  • Immutability.
  • Closures support.
  • Dynamic programming.
  • Functional programming.
  • Serialization support.
  • Actor framework.

The actor framework is really powerful. It supports the most important features required to create concurrent code without problems:

  • Actor locals.
  • Actor pools (using a shared thread pool).
  • Futures.
  • Timers.
  • Chaining.
  • Message passing.
  • Coalescing messages.
  • Flow control mechanisms.

If you need functional programming, immutability, message passing and actors, you can take a look at Fan. If you are working with JavaScript, keep an eye on Fan. It can help developers to tackle multicore with JavaScript.

In the forthcoming months, expect to see new libraries, languages, compilers and Domain-Specific Languages appearing to simplify parallel programming for many languages, virtual machines and run-times.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.