World Library  
Flag as Inappropriate
Email this Article
 

Fantom (programming language)

Fantom
Paradigm(s) multi-paradigm
Developer Brian Frank, Andy Frank
Appeared in 2005[1]
Stable release 1.0.66[2] / March 19, 2014 (2014-03-19)
Typing discipline static, dynamic
Influenced by C#, Java, Scala, Ruby, Erlang
License Academic Free License version 3.0[3]
Website www.fantom.org

Fantom is a general purpose object-oriented programming language created by Brian and Andy Frank[4] that runs on the Java Runtime Environment (JRE), JavaScript, and the .NET Common Language Runtime (CLR) (.NET support is considered "prototype"[5] status). Its primary design goal is to provide a standard library API[6] that abstracts away the question of whether the code will ultimately run on the JRE or CLR. Like C# and Java, Fantom uses a curly brace syntax. The language supports functional programming through closures and concurrency through the Actor model. Fantom takes a "middle of the road" approach to its type system, blending together aspects of both static and dynamic typing.

Contents

  • Typing 1
  • Pods 2
  • Fantom Widget Toolkit 3
  • "Hello World" example 4
  • Name change 5
  • Other features 6
  • See also 7
  • References 8
  • External links 9

Typing

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 (including Mac OS X).[7]

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 Fantom bytecode), 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

The Fantom build system can package a set of Pods into a JAR archive through build::JarDist.

Fantom Widget Toolkit

Fantom ships with a standard windowing toolkit called the Fantom Widget Toolkit, or FWT for short.[8] 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
{
  static Void main()
  {
    echo("Hello, World!")
  }
}

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 gaining some popularity members of the community raised concerns about the searchability of the name. In November 2009,[9] the name of the project was officially changed from Fan to Fantom.[10]

Other features

Fantom has other useful features:

  • Fantom supports imports of Java Classes and modules with some limitations.[11]
  • 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.[12]
  • Fantom does not support tuples (that is, types which are the Cartesian product of other types)[13]

See also

References

  1. ^ Blog post about history of Fantom
  2. ^ Build 1.0.66
  3. ^ FAQ of Fandoc language website
  4. ^ Fantom FAQ: Contact Us
  5. ^ Fantom FAQ: Roadmap
  6. ^ Fantom FAQ: Why Fantom?
  7. ^ http://www.infoworld.com/d/application-development/10-programming-languages-could-shake-it-181548?page=0,2
  8. ^ http://fantom.org/doc/fwt/pod-doc.html
  9. ^ History of Fantom programming language
  10. ^ Fan is officially now Fantom
  11. ^ Java FFI at Fantom home page
  12. ^ Serialization at Fantom.org
  13. ^ Tuples question at Fantom official page

External links

  • Official website
  • Why Fantom, by Fantom's authors, explains why they have created this language.
  • Not a Fan of Scala? An Evolutionary Approach | Ajaxonomy - blog post discussing Fan
  • The Fan Programming Language | Javalobby
  • Fan of a New Language | SD Times
  • Re: Fan Programming Language (jvm-languages@googlegroups.com mailing list) a forum post by one of Fantom's authors.
  • The Next Big JVM Language, a conversation with Stephen Colebourne by Bill Venners.
  • Language reference page at LangRef.org
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.