Skip to content

Instantly share code, notes, and snippets.

@teamon
Created December 16, 2010 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teamon/743598 to your computer and use it in GitHub Desktop.
Save teamon/743598 to your computer and use it in GitHub Desktop.
(0 to Int.MaxValue) == Range() // empty!
class X extends Actor {
def act {
val a = actor {
loop {
receive { // FAIL, must use 'self.receive'
case ...
}
}
}
}
}
class X extends Actor {
def act {
loop {
computeSomething (not react/receive) // FAIL, it blocks all actors
}
}
}
def gimmeSize[A,B](m: Map[A,B]) = m.size
val m = scala.collection.mutable.Map[String, Int]()
gimmeSize(m)
//<console>:8: error: type mismatch;
// found : scala.collection.mutable.Map[String,Int]
// required: Map[?,?]
// s(m)
// By default 'Map' is 'scala.collection.immutable.Map' and shared trait betwen
// mutable and immutable map is 'scala.collection.Map'
// Correct version:
def gimmeSize[A,B](m: scala.collection.Map[A,B]) = m.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment