Archive for July, 2009

I had this funny little Scala actor related bug today. Imagine you want to process a few things in parallel. So you go:
val processor = self
jobs.foreach { job =>
  actor {
    processor ! (job.id, job.run)
  }
}
// Merge results
for (i <- 1 to jobs.size) {
  self.receiveWithin(1000) {
    case (jobId:Int, result:JobResult) => mergeResult(result)
  }
}
All good. Then you realise that one or [...]