Skip to content

Instantly share code, notes, and snippets.

@pskupinski
Created July 2, 2010 11:04
Show Gist options
  • Save pskupinski/461227 to your computer and use it in GitHub Desktop.
Save pskupinski/461227 to your computer and use it in GitHub Desktop.
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