Fantom's type system is simple by design. All variables are statically typed, as they are in C# and Java. Fantom rejects generic types due to their complexity, but it does have a set of built-in generic types: List, Map, and Func. Fantom can also take on the feel of a dynamically typed language through dynamic calls and automatic downcasting. Fantom has an easy to use reflection API and metaprogramming capabilities. Fantom is open source under the Academic Free License 3.0 and is available for Windows and Unix-like platforms.
Pods
In Fantom, the unit of deployment is called a pod. Pods take on the role of namespaces, packages, and modules. They are stored as.pod files, which are zip files containing the FCode, the documentation, and resource files necessary to run the pod. A pod can define any number of types for use in other libraries and applications. A pod name fully qualifies a type name. For example, fwt::Widget is distinct from webapp::Widget. If a pod contains a type named Main, then it can be executed on the command line with: fan <podName> The Fantom build system can package a set of Pods into a JAR archive through build::JarDist.
Fantom ships with a standard windowing toolkit called the Fantom Widget Toolkit, or FWT for short. Like Fantom, FWT was designed to be portable across several platforms. It is currently implemented on the JVM using the Standard Widget Toolkit as a backend. The JavaScript implementation is backed by the canvas element and JavaFX, allowing FWT applications to be run in a web browser. There are plans for a CLR implementation using Windows Forms.
"Hello World" example
Here is the classic Hello world program written in Fantom: // Hello from Fantom! class HelloWorld
Notice that "Void" is capitalized. This is because Void is a class, not a primitive type in Fantom.
Name change
The original name of the Fantom programming language was Fan, named after the neighborhood where the creators live in Richmond, Virginia. After the language gained some popularity, members of the community raised concerns about the searchability of the name. In November 2009, the name of the project was officially changed from Fan to Fantom.
Other features
Fantom has other useful features:
Fantom supports imports of Java Classes and modules with some limitations.
Integer is 64-bit. Unlike Java and C#, Fantom does not have Long or Short integer types.
Serialization and deserialization of classes to/from strings.