Fantom (programming language): Difference between revisions

Content deleted Content added
Build 1.0.81
 
(37 intermediate revisions by 30 users not shown)
Line 1:
{{About|a programming language||Fantom (disambiguation)}}
{{multiple issues|
{{Tone|date=March 2012}}
{{primary sources|date=June 2018}}
}}
 
{{Infobox programming language
| name = Fantom
Line 6 ⟶ 10:
| paradigm = [[Multi-paradigm programming language|multi-paradigm]]
| year = 2005<ref>[http://fantom.org/sidewalk/topic/355 Blog post about history of Fantom]</ref>
| designer =
| developer = Brian Frank, Andy Frank
| latest_release_version = 1.0.6881
| latest_release_date = {{Start date and age|20162024|0412|0706}}<ref>{{cite web | url = httphttps://www.fantom.org/forum/topic/23872932 | title = Build 1.0.81 - Fantom | date = 76 AprilDecember 20162024}}</ref>
| typing = [[static typing|static]], [[dynamic typing|dynamic]]
| implementations =
| dialects =
| influenced_by = [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]], [[Scala (programming language)|Scala]], [[Ruby (programming language)|Ruby]], [[Erlang (programming language)|Erlang]]
| influenced =
| license = [[Academic Free License]] version 3.0<ref>[http://fantom.org/doc/docIntro/Faq.html FAQ of Fandoc language website]</ref>
| file ext = .fan, .fwt, .pod
Line 20 ⟶ 24:
}}
 
'''Fantom''' is a general -purpose [[object-oriented programming language]], created by Brian Frank and Andy Frank.<ref>[http://fantom.org/doc/docIntro/Faq.html#contact Fantom FAQ: Contact Us]</ref> thatIt runs on the [[Java Runtime Environment]] (JRE), [[JavaScript]], and the .NET [[Common Language Runtime]] (CLR) (.NET support is considered "prototype"<ref>[{{Cite web |url=http://fantom.org/doc/docIntro/Roadmap.html |title=Fantom FAQ: Roadmap] |access-date=2012-03-29 |archive-date=2015-12-11 |archive-url=https://web.archive.org/web/20151211122808/http://fantom.org/doc/docIntro/Roadmap.html |url-status=dead }}</ref> status). Its primary designstated goal is to provide a standard library [[application programming interface|API]].<ref>[http://fantom.org/doc/docIntro/WhyFantom.html Fantom FAQ: Why Fantom?]</ref> that abstracts away the question of whether the code will ultimately run on the JRE or CLR. Like [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]], Fantom uses a [[curly brace programming language|curly brace syntax]]. The language, supports [[functional programming]] through closures and concurrency through the [[Actor model]]., Fantomand takesblends a "middleaspects of theboth road"[[Type approach to itssystem#Static type system,checking|static]] blendingand together[[Type aspectssystem#Dynamic oftype both staticchecking and runtime type information|dynamic typing]].
 
The original name of the Fantom programming language was '''Fan''', named after the [[Fan district|neighborhood]] wherein which the creators live in [[Richmond, Virginia]]. After gaining some popularity, members of the community raised concerns about the [[Search engine optimization|searchability]] of the name. In November 2009,<ref>[http://es.scribd.com/doc/47962182/scala-haskell-and-fantom-programming-language History of Fantom programming language]</ref> the name of the project was officially changed from Fan to Fantom due to [[Search engine optimization|searchability]] concerns raised by its community.<ref name="Fantom rename">[http://fantom.org/sidewalk/topic/821 Fan is officially now Fantom]</ref>
== Typing ==
Fantom's type system is simple by design. All variables are statically typed, as they are in [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]]. Fantom rejects [[Generic programming|generic types]] due to their complexity, but it does have a set of built-in generic types: <tt>List</tt>, <tt>Map</tt>, and <tt>Func</tt>. 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 (computer science)|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).<ref>{{cite web |last=McAllister |first=Neil |date=2012-01-03 |title=10 programming languages that could shake up IT |url=http://www.infoworld.com/d/application-development/10-programming-languages-could-shake-it-181548?page=0,2 |titleaccessdate=2015-10 programming languages that could shake up IT-30 |publisher=InfoWorld |date=2012-01-03 |accessdate=2015-10-30}}</ref>
 
== PodsFeatures and systems ==
Fantom'sAll typevariables systemin is simple by design. All variablesFantom are statically typed, as theyit aredoes innot [[C Sharp (programming language)|C#]] and [[Java (programming language)|Java]]. Fantom rejectshave [[Generic programming|generic types]] due to their complexity, but it does have a set of built-in generic types: <ttcode>List</ttcode>, <ttcode>Map</ttcode>, and <ttcode>Func</ttcode>. Fantom can also take on the feel of a dynamically typed language throughsupports dynamic calls and automatic [[downcasting]]. Fantom has an easy to usea [[Reflection (computer science)|reflection]] API and [[metaprogramming]] capabilities.
In Fantom, the unit of deployment is called a ''pod''. Pods take on the role of [[namespace]]s, [[Java package|packages]], and [[Modular programming|modules]]. They are stored as .pod files, which are [[ZIP (file format)|zip]] files containing the FCode (the Fantom bytecode), the documentation, and [[Resource (Java)|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, <tt>fwt::Widget</tt> is distinct from <tt>webapp::Widget</tt>. If a pod contains a type named <tt>Main</tt>, then it can be executed on the command line with: <tt>fan &lt;podName&gt;</tt>
 
* Fantom supports imports of Java Classes and modules with some limitations.<ref>[http://fantom.org/doc/docLang/JavaFFI.html Java FFI at Fantom home page]</ref> Its integer is 64-bit. Unlike Java and C#, Fantom does not have Long or Short integer types. Fantom also does not support [[tuple]]s.<ref>[http://fantom.org/sidewalk/topic/1815 Tuples question at Fantom official page]</ref>
The Fantom build system can package a set of Pods into a [[JAR (file format)|JAR archive]] through <tt>build::JarDist</tt>.
 
In Fantom, the unit of deployment is called a ''pod''. Pods take on the role of [[namespace]]s, [[Java package|packages]], and [[Modular programming|modules]]. They are stored as .pod files, which are [[ZIP (file format)|zip]] files containing the FCode (the Fantom bytecode), the documentation, and [[Resource (Java)|resource files]] necessary to run the pod. AThe podFantom build system can definepackage anya numberset of typespods for use in other libraries and applications. A pod name fully qualifiesinto a type[[JAR name.(file Forformat)|JAR example,archive]] <tt>fwt::Widget</tt> is distinct fromthrough <ttcode>webappbuild::WidgetJarDist</ttcode>. If a pod contains a type named <tt>Main</tt>, then it can be executed on the command line with: <tt>fan &lt;podName&gt;</tt>
== Fantom Widget Toolkit ==
Fantom ships with a standard [[Widget toolkit|windowing toolkit]] called the Fantom Widget Toolkit, or FWT for short.<ref>{{cite web|url=http://fantom.org/doc/fwt/pod-doc.html |title=fwt – Fantom |publisher=Fantom.org |date=2015-01-08 |accessdate=2015-10-30}}</ref> 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]].
 
== Integrated development environment ==
== "Hello World" example ==
F4 is the main publicly available [[Integrated development environment|IDE]] for the Fantom language, officially supported by one of the main open-source contributors to the language, Steve Eynon.<ref>{{Cite web |title=Steve Eynon (MEng MIET) - Fantom Factory {{!}} LinkedIn |url=https://uk.linkedin.com/in/steveneynon |access-date=2023-12-14 |website=uk.linkedin.com |language=en}}</ref> The F4 IDE is available on GitHub.
Here is the classic [[Hello world program]] written in Fantom:
 
== Fantom Widget Toolkit ==
<source lang="fan" highlight="4">
Fantom ships with a standard [[Widget toolkit|windowing toolkit]] called the Fantom Widget Toolkit, or FWT for short.<ref>{{cite web |url=http://fantom.org/doc/fwt/pod-doc.html |title=fwt – Fantom |publisher=Fantom.org |date=2015-01-08 |accessdate=2015-10-30 |archive-date=2011-08-16 |archive-url=https://web.archive.org/web/20110816013612/http://fantom.org/doc/fwt/pod-doc.html |url-status=dead }}</ref> 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 from Fantom!
class HelloWorld
{
static Void main()
{
echo("Hello, World!")
}
</source>
 
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 [[Fan district|neighborhood]] where the creators live in [[Richmond, Virginia]]. After gaining some popularity, members of the community raised concerns about the [[Search engine optimization|searchability]] of the name. In November 2009,<ref>[http://es.scribd.com/doc/47962182/scala-haskell-and-fantom-programming-language History of Fantom programming language]</ref> the name of the project was officially changed from Fan to Fantom.<ref name="Fantom rename">[http://fantom.org/sidewalk/topic/821 Fan is officially now Fantom]</ref>
 
== Other features ==
Fantom has other useful features:
 
== TypingUsage ==
* Fantom supports imports of Java Classes and modules with some limitations.<ref>[http://fantom.org/doc/docLang/JavaFFI.html Java FFI at Fantom home page]</ref>
Escape the Mainframe is a browser game (just like the Google t-rex dinosaur) completely written in Fantom by Steve Eynon.<ref>{{Cite web |title=Escape the Mainframe! |url=http://escape.fantomfactory.org/ |access-date=2023-12-14 |website=escape.fantomfactory.org |language=en}}</ref>
* 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.<ref>[http://fantom.org/doc/docLang/Serialization.html Serialization at Fantom.org]</ref>
* Fantom does ''not'' support [[tuple]]s (that is, types which are the [[Cartesian product]] of other types)<ref>[http://fantom.org/sidewalk/topic/1815 Tuples question at Fantom official page]</ref>
 
== See also ==
{{Portal|Free and open-source software}}
* [[Boo (programming language)|Boo]]
* [[Ceylon (programming language)|Ceylon]]
* [[C Sharp (programming language)|C#]]
* [[Erlang (programming language)|Erlang]]
* [[Gosu (programming language)|Gosu]]
* [[Groovy (programming language)|Apache Groovy]]
* [[Kotlin (programming language)|Kotlin]]
* [[Scala (programming language)|Scala]]
* [[Ruby (programming language)|Ruby]]
 
Line 83 ⟶ 64:
== External links ==
* {{Official website}}
* [https://fantom-lang.org/download Open source website: https://fantom-lang.org/download]
* [http://fantom.org/doc/docIntro/WhyFantom.html Why Fantom], by Fantom's authors, explains why they have created this language.
* Open source repository for Fantom libraries https://eggbox.fantomfactory.org/
* [http://www.ajaxonomy.com/2008/java/not-a-fan-of-scala-an-evolutionary-approach Not a Fan of Scala? An Evolutionary Approach | Ajaxonomy] - blog post discussing ''Fan''
* Fantom portfolio https://fantom-lang.org/portfolio
* [http://www.sdtimes.com/link/33476 Fan of a New Language | SD Times]
* [http://www.ajaxonomy.com/2008/java/not-a-fan-of-scala-an-evolutionary-approach Not a Fan of Scala? An Evolutionary Approach | Ajaxonomy] {{Webarchive|url=https://web.archive.org/web/20100218052226/http://www.ajaxonomy.com/2008/java/not-a-fan-of-scala-an-evolutionary-approach |date=2010-02-18 }} - blog post discussing ''Fan''
* [http://article.gmane.org/gmane.comp.java.vm.languages/633 Re: Fan Programming Language (jvm-languages@googlegroups.com mailing list)] a forum post by one of Fantom's authors.
* [https://web.archive.org/web/20120902142339/http://www.sdtimes.com/link/33476 Fan of a New Language | SD Times]
* [https://archive.today/20130112181313/http://article.gmane.org/gmane.comp.java.vm.languages/633 Re: Fan Programming Language (jvm-languages@googlegroups.com mailing list)] a forum post by one of Fantom's authors.
* [http://www.artima.com/lejava/articles/javaone_2010_the_next_big_jvm_lang_stephen_colebourne.html The Next Big JVM Language], a conversation with Stephen Colebourne by Bill Venners.
* [https://web.archive.org/web/20121017004415/http://langref.org/fantom Language reference page at LangRef.org]
 
{{DEFAULTSORT:Fantom (Programming Language)}}