Created
December 16, 2010 16:24
Revisions
-
teamon revised this gist
Dec 20, 2010 . 1 changed file with 19 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,22 @@ class X extends Actor { 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 -
teamon revised this gist
Dec 16, 2010 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,12 @@ class X extends Actor { } } } } class X extends Actor { def act { loop { computeSomething (not react/receive) // FAIL, it blocks all actors } } } -
teamon created this gist
Dec 16, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ (0 to Int.MaxValue) == Range() // empty! class X extends Actor { def act { val a = actor { loop { receive { // FAIL, must use 'self.receive' case ... } } } } }