Skip to content

Instantly share code, notes, and snippets.

@ellbur
Created May 31, 2013 04:50
Show Gist options
  • Select an option

  • Save ellbur/5682993 to your computer and use it in GitHub Desktop.

Select an option

Save ellbur/5682993 to your computer and use it in GitHub Desktop.
Showing how react clobbers the stack and avoids a stack overflow
import scala.actors._
import Actor._
object YoDawg extends App {
val leonardo = actor {
def yo() {
println("yo")
reactWithin(1) {
case TIMEOUT => dawg()
}
}
def dawg() {
println("dawg")
reactWithin(1) {
case TIMEOUT => yo()
}
}
loop {
yo()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment