Take the 2-minute tour ×

I can say that I really love Scala but now I would like to know the features you cannot live without when working with Scala? What about Scala 2.8?

share|improve this question



should be community wiki. –  missingfaktor Apr 1 '10 at 18:11
Sorry for this. I changed this to be community wiki! –  Pekka Mattila Apr 5 '10 at 13:56

4 Answers 4

If I had to go back to Java here's what I'd miss the most: closures, higher order functions, pattern matching, case classes, and the emphasis on immutability.

I've been on 2.8 for a while. If I had to go back to 2.7, the main thing I'd miss is the consistency, cleanness, and richness of the 2.8 collections API. It's waaaaaay better the 2.7 stuff. But I'd also really miss named and default arguments.

share|improve this answer
+1. I was reviewing Java collections just the other day, and was overcome with the feeling that it was intentionally designed to be the worst API ever. –  Daniel C. Sobral Apr 1 '10 at 19:29
Daniel, I think you have to take a look at MFC's collection classes ;). I think Java's collections are not that bad considering that there is no anonymous functions in Java. –  Alexey Apr 2 '10 at 12:41

Type inference saves so much pointless typing. map and foreach and the like on collections are great, especially in combination with default-lazy iterators and really easy function syntax.

But, as someone who does a lot of scientific computing, what I'd actually miss the most is being able to write high-performance code, wrap it in efficient classes, and then use maps and mathematical operators (+, *, whatever) to manipulate those high-level constructs the way that I actually think about them.

As for 2.8 vs. 2.7--the improvement is pretty incremental from my perspective. It's a little better in many areas; there's little to point to and say, "Oh wow, that!". I expect the new specialized annotation will help me a lot, but I haven't seen it fully in action in the library yet, so I'm withholding judgment.

share|improve this answer

I enjoy writing in Scala. That's the #1 feature in my book :)

I can just get on with what I want instead of dancing through Java's hoops:

  • val/var means I don't have to write the type twice
  • Closures mean I don't have to write lots of anonymous interfaces and can re-use lots more code
  • Named parameters mean I don't have to remember the position of each argument - great for both reading and writing
  • Case classes mean I get toString and equals for free... makes debugging far easier!
  • A decent API for collections (e.g. map, fold) mean that I can say what I want to do instead of dancing the iteration dance

As for 2.8 vs 2.7... I've only ever really spent quality time with 2.8 ;-)

share|improve this answer

I think it is not a feature but the conciseness which Scala achieves is what I like the most.

This is of course only possible because of type inference, closures, a great type system etc. I just do not think you can break it down to one or two features. They work together and the result, concise code, is what I would call the killer feature.

share|improve this answer
