Created
May 31, 2013 04:50
-
-
Save ellbur/5682993 to your computer and use it in GitHub Desktop.
Showing how react clobbers the stack and avoids a stack overflow
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 characters
| 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