Scala, Haskell and Fantom Programming Language
Scala, Haskell and Fantom Programming Language
Language
What is Scala?
Scala is a multi-paradigm programming language designed to integrate
features of object-oriented programming and functional programming. The
name Scala stands for ”scalable language”, signifying that it is designed to
grow with the demands of its users.
Scala is a general purpose programming language designed to express
common programming patterns in a concise, elegant, and type-safe way. It
smoothly integrates features of object-oriented and functional languages, en-
abling Java and other programmers to be more productive.
History of Scala
1
Seamless integration with JAVA
Existing Java code and programmer skills are fully re-usable. Scala pro-
grams run on the Java VM, are byte code compatible with Java so you can
make full use of existing Java libraries or existing application code. You can
call Scala from Java and you can call Java from Scala, the integration is
seamless.
Moreover, you will be at home with familiar development tools, Eclipse,
NetBeans or Intellij for example, all of which support Scala.
Scala is object-oriented
Scala is functional
• generic classes
• variance annotations
2
• compound types
• views, and
• polymorphic methods.
Scala is extensible
object HelloWorld
{
def main(args: Array[String])
{
println("Hello, world!")
}
}
3
Haskell Programming Language
What is Haskell?
Haskell is an advanced purely-functional programming language. An
open-source product of more than twenty years of cutting-edge research, it
allows rapid development of robust, concise, correct software.
Haskell is a computer programming language. In particular, it is a poly-
morphically statically typed, lazy, purely functional language, quite different
from most other programming languages. The language is named for Haskell
Brooks Curry, whose work in mathematical logic serves as a foundation for
functional languages.
Haskell is based on the lambda calculus, hence the lambda we use as a
logo. It is a standardized, general-purpose purely functional programming
language, with non-strict semantics and strong static typing.
History of Haskell
Haskell 1.0
In late 1997, the series culminated in Haskell 98, intended to specify a sta-
ble, minimal, portable version of the language and an accompanying standard
library for teaching, and as a base for future extensions. In February 1999,
the Haskell 98 language standard was originally published as The Haskell
98 Report. In January 2003, a revised version was published as Haskell 98
Language and Libraries: The Revised Report.
Haskell Prime
4
Haskell 2010
Haskell 2010 adds the Foreign Function Interface (FFI) to Haskell, allow-
ing for bindings to other programming languages, fixes some syntax issues
(changes in the formal grammar) and bans so-called n-plus-k-patterns, that
is, definitions of the form fak (n+1) = (n+1) * fak n are no longer allowed.
It introduces the Language-Pragma-Syntax-Extension which allows for des-
ignating a haskell source as Haskell 2010 or requiring certain Extensions to
the Haskell Language. The names of the extensions introduced in Haskell
2010 are DoAndIfThenElse, HierarchicalModules, EmptyDataDeclarations,
FixityResolution, ForeignFunctionInterface, LineCommentSyntax, Pattern-
Guards, RelaxedDependencyAnalysis, LanguagePragma, NoNPlusKPatterns.
"Hello, World!"
OR
putStrLn "Hello World"
OR
main = putStrLn "Hello, World!"
5
Fantom Programming Language
What is Fantom?
History of Fantom
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, the name of the project
was officially changed from Fan to Fantom.
Typing
6
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 ¡podName¿ The Fantom build system can package a set of Pods
into a Jar archive through build::JarDist.
Portability
Fantom is created to write software that can seamlessly run on both the
Java VM and the .NET CLR. The reality is that many software organiza-
tions are committed to one or the other of these platforms. Even dynamic
languages like Python and Ruby are getting hosted on one of these VMs.
Familiar Syntax
Java and C-sharp programmers will feel at home with Fantom’s evolu-
tionary syntax.
Elegant APIs
Quite obsessive about providing all the key features required for a stan-
dard library, but with much less surface area than the APIs found in Java or
.NET.
Object Oriented
Fantom follows the .NET model of value types. The three special types
Bool, Int, and Float are value types which are implemented as primitives in
Java and value types in .NET. These types have all the same performance
characteristics of using boolean, long, and double in Java or C-sharp. Unlike
Java these types cleanly subclass from Obj to create a unified class hier-
archy. The compiler automatically implements boxing and unboxing when
necessary.
7
Funtional Programming
Declarative Programming
Concurrency
class HelloWorld
{
static Void main()
{
echo("Hello, World!")
}
}