Scala, Haskell and Fantom Programming Language

Raymark D. Dulce (200712952) January 01, 2011

As of November 2010. To the JVM.NET libraries in the .8. History of Scala The design of Scala started in 2001 at the cole Polytechnique F d rale de Lausanne (EPFL) by Martin Odersky. Scala code and Java code are indistinguishable. It smoothly integrates features of object-oriented and functional languages. a programming language combining ideas from functional programming and Petri nets. was released in March 2006.1. 1 .jar. The Scala compiler generates byte code that is nearly identical to that generated by the Java compiler.Scala Programming Language What is Scala? Scala is a multi-paradigm programming language designed to integrate features of object-oriented programming and functional programming. Scala is a general purpose programming language designed to express common programming patterns in a concise. v2.NET implementation). Platforms and License Scala runs on the Java platform(Java Virtual Machine) and is compatible with existing Java programs. Scala’s operational characteristics are the same as Java’s. A second version of the language. following on from work on Funnel. including compiler and libraries. scala-library. elegant. Micro Edition Connected Limited Device Configuration. Scala was released late 2003 / early 2004 on the Java platform. Scala code can be decompiled to readable Java code. Sun’s Java compiler. In fact.NET platform in June 2004. The name Scala stands for ”scalable language”. signifying that it is designed to grow with the demands of its users. enabling Java and other programmers to be more productive. Odersky had previously worked on Generic Java and javac. and on the . and type-safe way. Scala has the same compilation model as Java and C-sharp. so Scala code can call Java libraries (or . is released under a BSD license. with the exception of certain constructor operations. It also runs on Java Platform.0. The only difference is a single extra runtime library. the latest release is version 2. The Scala software distribution.

Classes are extended by subclassing and a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance.Seamless integration with JAVA Existing Java code and programmer skills are fully re-usable. Moreover. You can call Scala from Java and you can call Java from Scala. Scala provides a lightweight syntax for defining anonymous functions. NetBeans or Intellij for example. the integration is seamless. Scala programs run on the Java VM. In particular. Scala is object-oriented Scala is a pure object-oriented language in the sense that every value is an object. it allows functions to be nested. Scala’s case classes and its built-in support for pattern matching model algebraic types. and supports currying. you will be at home with familiar development tools. Scala is statically typed Scala is equipped with an expressive type system that enforces statically that abstractions are used in a safe and coherent manner. Scala is functional Scala is also a functional language in the sense that every function is a value. it supports higher-order functions. the type system supports: • generic classes • variance annotations • upper and lower type bounds • inner classes and abstract types as object members 2 . all of which support Scala. Eclipse. Types and behavior of objects are described by classes and traits. are byte code compatible with Java so you can make full use of existing Java libraries or existing application code.

and • polymorphic methods. Scala provides a unique combination of language mechanisms that make it easy to smoothly add new language constructs in form of libraries: • any method may be used as an infix or postfix operator. • A joint use of both features facilitates the definition of new statements without extending the syntax and without using macro-like meta programming facilities. world!") } } 3 .• compound types • explicitly typed self references • views. The Hello World Program object HelloWorld { def main(args: Array[String]) { println("Hello. Scala is extensible In practice. the development of domain-specific applications often requires domain-specific language extensions. and closures are constructed automatically depending on the expected type (target typing).

it is a polymorphically statically typed. In particular. portable version of the language and an accompanying standard library for teaching. quite different from most other programming languages. The first revision. a revised version was published as Haskell 98 Language and Libraries: The Revised Report. the series culminated in Haskell 98. Haskell is a computer programming language. An open-source product of more than twenty years of cutting-edge research. Haskell 98 In late 1997. lazy. 2009. whose work in mathematical logic serves as a foundation for functional languages. was begun. and as a base for future extensions. the process of defining a successor to the Haskell 98 standard. with non-strict semantics and strong static typing. 4 . This is an ongoing incremental process to revise the language definition. producing a new revision once per year. intended to specify a stable.0) was defined in 1990. it allows rapid development of robust. In January 2003.0 The first version of Haskell (Haskell 1. History of Haskell Haskell 1. informally named Haskell’. hence the lambda we use as a logo. general-purpose purely functional programming language. concise. named Haskell 2010. Haskell Prime In early 2006. the Haskell 98 language standard was originally published as The Haskell 98 Report. minimal. In February 1999.Haskell Programming Language What is Haskell? Haskell is an advanced purely-functional programming language. Haskell is based on the lambda calculus. was announced in Nov. correct software. The language is named for Haskell Brooks Curry. purely functional language. It is a standardized.

ForeignFunctionInterface. LineCommentSyntax. PatternGuards. fixes some syntax issues (changes in the formal grammar) and bans so-called n-plus-k-patterns. allowing for bindings to other programming languages. FixityResolution. and more maintainable code. World!" 5 . EmptyDataDeclarations. • A smaller semantic gap between the programmer and the language. • Shorter lead times. It introduces the Language-Pragma-Syntax-Extension which allows for designating a haskell source as Haskell 2010 or requiring certain Extensions to the Haskell Language. HierarchicalModules. RelaxedDependencyAnalysis. • Fewer errors. World!" OR putStrLn "Hello World" OR main = putStrLn "Hello. clearer. Why use Haskell? Haskell offers you: • Substantially increased programmer productivity • Shorter. The names of the extensions introduced in Haskell 2010 are DoAndIfThenElse. NoNPlusKPatterns. The Hello World Program "Hello.Haskell 2010 Haskell 2010 adds the Foreign Function Interface (FFI) to Haskell. definitions of the form fak (n+1) = (n+1) * fak n are no longer allowed. higher reliability. that is. LanguagePragma.

Fantom has an easy to use reflection API and metaprogramming capabilities. Fantom is designed as a practical programming language to make it easy and fun to get real work done. Fantom is an exciting new language that targets the Java VM and the CLR. named after the neighborhood where the creators live in Richmond. and Javascript. but it does have a set of built-in generic types: List. After gaining some popularity.Python.NET. Fantom takes a middle of the road approach to its type system. blending together aspects of both static and dynamic typing. The language supports functional programming through closures and concurrency through the Actor model. as they are in C-sharp and Java.Erlang etc. Map. Virginia. It borrows it’s Syntax from Java but also adds many features and syntactic sugar created or borrowed from . Like C-sharp and Java. 6 . Fantom rejects generic types due to their complexity. Typing Fantom’s type system is simple by design.Net programmer but is much less painful to use (no boilerplate). History of Fantom The original name of the Fantom programming language was Fan. Fantom can also take on the feel of a dynamically typed language through dynamic calls and automatic downcasting. Fantom uses a curly brace syntax. All variables are statically typed. . members of the community raised concerns about the searchability of the name.Fantom Programming Language What is Fantom? Fantom is a general purpose object-oriented programming language that runs on the JRE. the name of the project was officially changed from Fan to Fantom. In November 2009. and Func.NET CLR.Groovy. It is familiar to a Java / .

Portability Fantom is created to write software that can seamlessly run on both the Java VM and the . Even dynamic languages like Python and Ruby are getting hosted on one of these VMs. long. the documentation.NET. For example. Object Oriented Fantom follows the . but with much less surface area than the APIs found in Java or . A pod name fully qualifies a type name. packages. Elegant APIs Quite obsessive about providing all the key features required for a standard library. These types have all the same performance characteristics of using boolean. If a pod contains a type named Main. and resource files necessary to run the pod. A pod can define any number of types for use in other libraries and applications.NET CLR. fwt::Widget is distinct from webapp::Widget. 7 .NET model of value types. and double in Java or C-sharp. and modules.NET. The compiler automatically implements boxing and unboxing when necessary. They are stored as . Int. which are zip files containing the FCode (the Fantom bytecode). 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. and Float are value types which are implemented as primitives in Java and value types in .pod files. the unit of deployment is called a pod. The reality is that many software organizations are committed to one or the other of these platforms. Pods take on the role of namespaces. Unlike Java these types cleanly subclass from Obj to create a unified class hierarchy.Pods In Fantom. Familiar Syntax Java and C-sharp programmers will feel at home with Fantom’s evolutionary syntax. The three special types Bool.

World!") } } 8 .so you can paste a serialization file right into your source code as an expression. and durations. Closures are a key feature of the language. and all the APIs are written to use functions and closures where appropriate. Declarative Programming Fantom incorporates declarative programming right into the language. Functions and closures are baked in. The serialization syntax is a clean subset of the programming language . uris. maps. Fantom also includes a text serialization syntax which is human readable and writable.Funtional Programming Fantom was designed from the ground up to support functions as first class objects. ranges. Fantom supports a literal syntax for lists. Concurrency Fantom tackles concurrency using a couple techniques: • Immutability is built into the language (thread safe classes) • Static fields must be immutable (no shared mutable state) • Actors model for message passing (Erlang style concurrency) The Hello World Program class HelloWorld { static Void main() { echo("Hello.

Sign up to vote on this title
UsefulNot useful