Questions tagged [scala]
Scala is a general-purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles. Its key features are: an advanced static type system with type inference; function types; pattern-matching; implicit parameters and conversions; operator overloading; full interoperability with Java; concurrency
scala
112,623
questions
871
votes
18
answers
116k
views
Is the Scala 2.8 collections library a case of "the longest suicide note in history"? [closed]
I have just started to look at the Scala collections library re-implementation which is coming in the imminent 2.8 release. Those familiar with the library from 2.7 will notice that the library, from ...
746
votes
13
answers
245k
views
Difference between object and class in Scala
I'm just going over some Scala tutorials on the Internet and have noticed in some examples an object is declared at the start of the example.
What is the difference between class and object in Scala?
676
votes
6
answers
180k
views
Scala vs. Groovy vs. Clojure [closed]
Can someone please explain the major differences between Scala, Groovy and Clojure. I know each of these compiles to run on the JVM but I'd like a simple comparison between them.
622
votes
12
answers
179k
views
What are the best use cases for Akka framework [closed]
I have heard lots of raving about Akka framework (Java/Scala service platform), but so far have not seen many actual examples of use cases it would be good for. So I would be interested in hearing ...
611
votes
7
answers
172k
views
What are all the uses of an underscore in Scala?
I've taken a look at the list of surveys taken on scala-lang.org and noticed a curious question: "Can you name all the uses of “_”?". Can you? If yes, please do so here. Explanatory examples are ...
494
votes
17
answers
150k
views
What is the difference between Scala's case class and class?
I searched in Google to find the differences between a case class and a class. Everyone mentions that when you want to do pattern matching on the class, use case class. Otherwise use classes and also ...
449
votes
1
answer
14k
views
Scalaz iteratees: "Lifting" `EnumeratorT` to match `IterateeT` for a "bigger" monad
If I have an EnumeratorT and a corresponding IterateeT I can run them together:
val en: EnumeratorT[String, Task] = EnumeratorT.enumList(List("a", "b", "c"))
val it: IterateeT[String, Task, Int] = ...
438
votes
11
answers
137k
views
What do all of Scala's symbolic operators mean?
Scala syntax has a lot of symbols. Since these kinds of names are difficult to find using search engines, a comprehensive list of them would be helpful.
What are all of the symbols in Scala, and what ...
438
votes
2
answers
58k
views
Where does Scala look for implicits?
An implicit question to newcomers to Scala seems to be: where does the compiler look for implicits? I mean implicit because the question never seems to get fully formed, as if there weren't words for ...
422
votes
11
answers
75k
views
What is the difference between self-types and trait subclasses?
A self-type for a trait A:
trait B
trait A { this: B => }
says that "A cannot be mixed into a concrete class that does not also extend B".
On the other hand, the following:
trait B
trait A ...
405
votes
8
answers
108k
views
What is the advantage of using abstract classes instead of traits?
What is the advantage of using an abstract class instead of a trait (apart from performance)? It seems like abstract classes can be replaced by traits in most cases.
402
votes
4
answers
212k
views
Scala list concatenation, ::: vs ++
Is there any difference between ::: and ++ for concatenating lists in Scala?
scala> List(1,2,3) ++ List(4,5)
res0: List[Int] = List(1, 2, 3, 4, 5)
scala> List(1,2,3) ::: List(4,5)
res1: List[...
390
votes
11
answers
85k
views
How do I get around type erasure on Scala? Or, why can't I get the type parameter of my collections?
It's a sad fact of life on Scala that if you instantiate a List[Int], you can verify that your instance is a List, and you can verify that any individual element of it is an Int, but not that it is a ...
384
votes
1
answer
81k
views
What is a TypeTag and how do I use it?
All I know about TypeTags is that they somehow replaced Manifests. Information on the Internet is scarce and doesn't provide me with a good sense of the subject.
So I'd be happy if someone shared a ...
383
votes
5
answers
201k
views
Difference between a Seq and a List in Scala
I've seen in many examples that sometimes a Seq is being used, while other times is the List...
Is there any difference, other than the former one being a Scala type and the List coming from Java?