Not a Fan of Scala? An Evolutionary Approach


The Scala programming language, heralded by many of the Java cognoscenti as the language to replace Java, has garnered well-deserved praise as a sophisticated and capable language. But to many who have grown up in the tradition of C-C++-Java, Scala's hybrid imperative-functional design may be just too alien to their sensibilities. Given the history of popular programming languages, this is not a surprise. It was, after all, not Smalltalk but C++ that introduced OOP to the masses; and Java in no small way gained popularity by fixing many of the pains involved with programming in C++ while still retaining the same general style of syntax.

Now along comes a language called Fan, which takes a more evolutionary (as opposed to revolutionary) approach to language design, incorporating concepts from Java, C#, Ruby, and other languages (e.g. Erlang) into a fluid style that would be very comfortable for a programmer well-versed in any of these languages.

Here is a short list of interesting features in the Fan language:

  • Compiles to either JVM or .NET bytecode.
  • A Ruby-like syntax for using closures (with the method signature expression enclosed between two "|"). Like C#, functions are first-class citizens in Fan (represented by the Func class).
  • Fan has no concept of interface classes, but rather uses mixins for multiple inheritance. Mixins are like abstract classes in Java (i.e., they can declare concrete method implementations), but can contain no state (i.e., fields). This addresses one of the weaknesses of interfaces in Java (and C#), namely that it is very difficult to introduce new methods into the interface without breaking all of the existing implementations of this interface; this is a problem in widely-used public-facing APIs such as the Collections API in Java.
  • All threads in Fan have the ability to pass messages to other threads, i.e they use the Actor model for concurrency popularized by Erlang.
  • Fan is, generally speaking, a strongly and statically typed language. But Fan supports a special syntax for using dynamic typing with a "dynamic call operator", the "->". This operator allows you to call a method on a class without the compiler enforcing type checking. In other words, you don't have to cast a type just to call a method.
  • A unified namespace and deployment structure. The deployment unit in Fan is called the "pod". The first part of a namespace is always the deployment unit (pod), so identifying a missing class becomes much easier than the "jar hell" of Java (though arguably Maven makes this much easier).
  • Fan supports a "literal syntax" for programming with lists, maps, etc. that makes working with these common elements much easier.

More thorough documentation on the language is available here. In general, Fan does not introduce any world shaking concepts--certainly all of its elements are present in some form or another in other programming languages--but is distinguished by the fact that it makes very smart decisions about which features to use, combining them in a style that is both fluid and familiar to the average programmer.

sounds like it could be good, I wonder how many years it would take for it to become as popular a Java.

Hi, so what is better, FAN or Scala? I mean I have to choose one for a project.

My feeling is Scala is better at this moment, FAN seems too young. However when FAN grows up, what is better then?


Better is a hard thing to define here. Languages are very human (developer)-centric...after all, by the time your computer actually "sees" it, it is not that language at all but a bunch of processor instructions. The best language, then, is what you find comfortable and productive.

Scala is a very sophisticated language with a non-trivial learning curve. When you really dig into it, I think that it also tends to be a more functionally-oriented programming language than imperative. Languages like Fan come from the opposite direction--they are more imperative, but add many functionally-oriented language features to the mix. This is one of the reasons I felt that Fan takes a more evolutionary approach from C/C++/Java. Java is going to be around for a long time, and it will continue to evolve, but there is a definite window of opportunity opening up for another language to succeed it. My gut feeling is that this new language will (1) take a more evolutionary approach (so that it will feel more comfortable for the huge installed based of Java programmers) (2) will be built on top of the well-optimized and cross-platform JVM (why re-invent the wheel?), (3) will incorporate new features, such as closures, and (4) will fix many of the "pain points" with developing in Java. Fan is the closest thing that I have seen that fits these criteria; this doesn't mean that Fan will be the next big thing, of course, just that the ingredients are there.

As for maturity, yes, Scala is far more mature at this moment. If you have a particular project starting (and were choosing between just Scala and Fan), Scala would have the edge on maturity. Fan is very actively evolving at this point in time.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <div> <blockquote> <object> <embed> <img> <param>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Copy the characters (respecting upper/lower case) from the image.