Scala Language

Designed by Martin Odersky, Scala is a modern Multi Paradigm Programming Language designed to express common programming patterns in a concise, elegant, and Type Safe way. It smoothly integrates features of Object Oriented Programming and Functional Programming languages.

www.artima.com - "A Brief History of Scala" by Odersky

www.artima.com - "First Steps to Scala"

www.artima.com - "Programming in Scala" - the book - Pre-print PDF available.

Monads and Arrows have been implemented in Scala Language - see lucdup.blogspot.com

Book: Programming Scala Wampler and Payne ( Oreilly And Associates )


For a discussion on the nature of Scala Language see enfranchisedmind.com


20101003 Chris Garrod tried to put this into Hello World In Many Programming Languages, but that page kept being reverted by computing-technology.derby.ac.uk. What a deterrent to editing! In my ten years at this wiki, this is the first time my changes been attacked by a robot. Recent Changes discourages me from participation here.

Hello World in Scala is discussed in several steps on this page: www.artima.com

println("Hello, world, from a script!")


Brid Jay (BridJ) is a way for Java Language and Scala Language to make calls to Cee Language or Cee Plus Plus code.


Scala, it seems to me, is about making Java cleaner, while adding some functional concepts in the process. For example, instead of static methods on a class, you define a singleton object for the class.

object HelloWorld { def main : Unit = println("Hello, world!") // This is a method, not a variable. Variables are introduced with var. }

This is different from the static-method-on-class model because it makes an actual, first-class object.

class My List[+T](first :
T, rest : My List[T]) {// Constructors look like ordinary closures. Very clean! Even C++ doesn't have initialization this clean!

// ^---------- Note:
type variance of T is covariant.

def foreach(op :
T => Unit) : Unit = { // Higher-order foreach function.

// Just like HaskelLanguage''''''s a -> (). Foreach's type in Haskel would be written as ml a -> (a -> ()) -> (). op(first) rest.foreach(op) } } // The above is not actually the important part, otherwise I would have introduced a lot more features there. object MyNil extends MyList[Nothing] { // Nothing is the BottomType. override def foreach(op : Any => Unit) = () // Do nothing at last list instance. // (Oh, Any is the TopType.) } /* Roughly equivalent to: val MyNil = new MyList[Nothing] { override def foreach(op : Any => Unit) = () } However, you can declare objects which are also classes, to get static members. Also, you can make those objects-of-classes functor objects. This means you can use the factory pattern without actually appearing to use it! */ MyList(1, MyList(2, MyList(3, Nil))) foreach print // Demonstration of Scala's flexible syntax: infix methods. // Operators like +, -, *, and / are actually parsed as infix methods. // Oh, and functions are first-class.


See original on c2.com