I’ve been having this itch lately to try out some new languages than my primary language – Ruby. The idea is to just branch and develop new skills and learn more. Before marching on onto this new excursion I had a few pre-requisites in mind, the new language should be:
- Functional. (No specific reason, just to polish my functional skills a tad more)
- Elegant Concurrency model.
- Fun to write and test.
- Nice and Easily searchable documentation.
I had a few choices at hand, such as Go Lang, Scala and Erlang etc. All of these languages are well known and respected within the community for their robustness and stability. Some of these languages have been making quite some news among the community as well.
So, why Scala?
After doing some research on some of the above mentioned languages I finally chose Scala for two reasons over others:
- There are some striking similarities between some constructs in Scala and Ruby – So I’m hoping it’ll be easier to pick up the language. Checkout this presentation.
- No need to put ; at the end. This one is probably the most important aspect.
The below instructions are for Mac OS X, should work equally well on a Linux machine but there might be some nuances. Let me know in the comments if you come across any issues.
- Make sure you have Java installed.
- Download Scala from: http://www.scala-lang.org/download/
- Extract the .tgz file.
- Move directory to your /usr/bin/scala
- Add /usr/bin/scala/bin to your /etc/paths file.
- Reload your terminal.
Now, Scala should be installed on your computer, and you shall be able to load up the Scala REPL by just typing scala in your terminal.
Now, I’m all set to crank out some Scala code and learn more. If you are en-route this journey of learning Scala, feel free to leave your comments and share your experience.
:~ jasdeep$ scala
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> println("Hello world!")