Posts: 135 / Nickname: fsommers / Registered: January 19, 2002 7:24 AM
Scala: A Scalable Language
May 6, 2008 0:00 AM
|
This article, based on Chapter 1 of the book <a href="http://www.artima.com/shop/forsale">Programming in Scala</a>, describes the scalable programming features of Scala:
http://www.artima.com/scalazine/articles/scalable-language.html What do you think of the language features described in the article? |
Posts: 7 / Nickname: goddard / Registered: May 17, 2007 0:16 AM
Re: Scala: A Scalable Language
May 6, 2008 10:11 PM
|
scala sounds great.
the val (value) is like constant, var (variable) is nothing more than variable - it can change its value whenever. |
Posts: 14 / Nickname: aeoo / Registered: April 12, 2006 7:02 AM
Re: Scala: A Scalable Language
May 6, 2008 5:51 PM
|
The language features sound great to me.
Can anyone comment on Rich Hickey's decision to make all values read-only in Clojure and how Scala compares in that regard? Does anyone believe that, paraphrased, "updatable values are the new spaghetti code", as Rich says? If no, why not? If yes, what does Scala do about it? |
Posts: 2 / Nickname: joshcough / Registered: January 20, 2008 1:43 PM
Re: Scala: A Scalable Language
May 6, 2008 7:50 PM
|
I can't say much about Clojure, but I do agree that state leads to spaghetti in most situations.
Scala allows you to have read-only, and writable fields called val, and var. I think it is normally suggested that you use val, (everything immutable) unless you have a really good reason for state. My rather uneducated guess is that Scala allows for var because (hardcore functional programmers please don't kill me) it makes sense in some situations, and to ease Java programmers into functional programming. |
Posts: 8 / Nickname: alexstojan / Registered: June 20, 2005 0:51 PM
Re: Scala: A Scalable Language
May 7, 2008 6:14 AM
|
> My rather uneducated guess is that Scala allows for var
> because (hardcore functional programmers please don't kill > me) it makes sense in some situations, and to ease Java > programmers into functional programming. It definitely makes sense in certain situations to be able to use state, i.e. mutable objects. For example, if you have a queue that you need to modify it would be very inefficient to create a new queue every time you do an add or remove. |
Posts: 4 / Nickname: vijaykandy / Registered: January 25, 2007 6:08 AM
Re: Scala: A Scalable Language
May 7, 2008 7:42 AM
|
Looks like Scala borrowed a lot of concurrency constructs from Erlang rather than from Java. Now I am interested in Scala :)
|
Posts: 2 / Nickname: joshcough / Registered: January 20, 2008 1:43 PM
Re: Scala: A Scalable Language
May 7, 2008 7:56 AM
|
Scala did borrow the actor model from Erlang, and built it on top of Doug Lea's fork-join.
|
Posts: 7 / Nickname: goddard / Registered: May 17, 2007 0:16 AM
Re: Scala: A Scalable Language
May 7, 2008 11:00 AM
|
actually scala borrowed a lot of things from many languages, it's a good blend :)
|
Posts: 3 / Nickname: apollodude / Registered: December 10, 2008 6:51 AM
Re: Scala: A Scalable Language
December 10, 2008 1:00 PM
|
If I understand correctly:
1. The object composition pattern is a language feature in Scala. I imagine this would make a much bigger difference in scalability than combining object-oriented and functional paradigms. 2. Also exciting is the way Scala, like Smalltalk, is a small language with a big API, where operators have almost no special rules regarding lexical or syntactic analysis as they do in languages with far more complex grammars, such as Java or C#. Hooray for Scala! |