Created
December 6, 2011 04:58
-
-
Save chrislewis/1436818 to your computer and use it in GitHub Desktop.
Scala script file (embedded example)
This file contains 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
/* | |
* Script for an embedded compiler like https://github.com/twitter/util/blob/master/util-eval/src/main/scala/com/twitter/util/Eval.scala | |
* The script is read as a string and wrapped in a randomly generated subclass of () => Any. | |
* The contents of the script constitute the body of the generated class' apply method. | |
* The interpreter loads the generated class, casts to () => Any, and invokes apply, presumably | |
* casting to a type parameter as needed. | |
* The end result of an interpreted file is just like a statement in scala: the last value | |
* is the result (also note that the entire body of the script is scoped to the containing method). | |
*/ | |
import com.stuff._ | |
new Config( | |
jdbc = "jbc:mysql....", | |
mongo = MongoConnection("localhost") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment