Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of Scala programming language? [closed]

It is my opinion that every language was created for a specific purpose. What was Scala created for and what problems does it best solve?

like image 698
user68109 Avatar asked Jun 30 '09 20:06

user68109


People also ask

What is the purpose of Scala?

Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.

Is Scala a general-purpose language?

Scala is a statically-typed, general-purpose programming language that can be both Object-Oriented as well as Functional, which makes it a very flexible language.

What's special about Scala?

Scala is dynamic and strongly statically typed language. It provides type interface for variables and functions that is better than limited type interface in other language like C# and Java. It also provides a compiler that uses type reference to a full extent.


1 Answers

One of the things mentioned in talks by Martin Odersky on Scala is it being a language which scales well to tackle various problems. He wasn't talking about scaling in the sense of performance but in the sense that the language itself can seem to be expanded via libraries. So that:

val lock = new ReentrantReadWriteLock lock withReadLock {    //do stuff } 

Looks like there is some special syntactic sugar for dealing with j.u.c locks. But this is not the case, it's just using the scala language in such a way as it appears to be. The code is more readable, isn't it?

In particular the various parsing rules of the scala language make it very easy to create libraries which look like a domain-specific language (or DSL). Look at scala-test for example:

describe("MyCoolClass") {    it("should do cool stuff") {      val c = new MyCoolClass      c.prop should be ("cool")   } }  

(There are lots more examples of this - I found out this one yesterday). There is much talk about which new features are going in the Java language in JDK7 (project coin). Many of these features are special syntactic sugar to deal with some specific issue. Scala has been designed with some simple rules that mean new keywords for every little annoyance are not needed.

like image 103
oxbow_lakes Avatar answered Oct 11 '22 04:10

oxbow_lakes