Thoughts about java, ruby, agile and other every developer stuff.

Friday, April 20, 2007

Scala

Our last seminar was abort scala language. I met with this language in December 2006 when I was prepared own seminary about java kingdom of languages. Martin Odersky makes experiment to create functional and object programming language. He chose java virtual machine as a compilation platform so scala has great library support.

One of very interesting feature from java perspective is patter matching (known from other functional languages SML, Heskell).

abstract class Tree
case class Sum(l: Tree, r: Tree) extends Tree
case class Var(n: String) extends Tree
case class Const(v: int) extends Tree

This snapshot is from scala tutorial. The case modifier makes from normal class a class with standard definition of getters for parameters, equals, hashCode, toString. Now through patter matching scala can evaluate Tree expression depends on the match to class Sum, Car, Const.

Scala has mixins, methods can have names like =, +, - etc., and true genericity , another interesting thin is xml included (maybe in jdk7) so we can define variable such as:

xml_data = <phonebook><name>Imie</name></phonebook>

Last interesting fact is that scala allows you to use Actors to simple send and receive messages (Erlang style).

It’s very interesting language and of course we have even now web framework for it. It’s name is lift

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home