Created
July 2, 2010 11:04
-
-
Save pskupinski/461227 to your computer and use it in GitHub Desktop.
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._ | |
import org.python.core._ | |
import org.python.util._ | |
/** | |
* A hack to avoid Jython throwing up from trying to use a method named !. | |
*/ | |
def send(a: Actor, msg: Any) { | |
a ! msg | |
} | |
val interp = new PythonInterpreter | |
interp.set("a", self) | |
interp.set("hack", this) | |
interp.exec("hack.send(a, \"Blah\")") | |
/* In a perfect world this is what I'd like to be able to do: | |
* interp.exec("a.!(\"Blah\")") | |
* but Jython vomits at the sight of a method named !. | |
*/ | |
receive { | |
case "Blah" => println("Got \"Blah\"") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment