Skip to content

Instantly share code, notes, and snippets.

@razie
Created September 8, 2010 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razie/570783 to your computer and use it in GitHub Desktop.
Save razie/570783 to your computer and use it in GitHub Desktop.
class Interpreter(val settings: Settings, out: PrintWriter) {
repl =>
// 1. Request is private. I need: dependencies (usedNames?) newly defined values (boundNames?)
// the resulting value and the error message(s) if any
case class PublicRequest (usedNames : List[String], valueNames:List[String], extractionValue:Option[Any])
// 2. Can't get the last request
def lastRequest : Option[PublicRequest] =
prevRequests.lastOption map (l =>
PublicRequest (l.usedNames.map(_.decode), l.valueNames.map(_.decode), l.extractionValue)
)
... // the rest of the Interpreter class
@razie
Copy link
Author

razie commented Sep 8, 2010

This is a quick "hack" to allow access to the internal class Request of the scala.nsc.tools.Interpreter.scala - this is needed in "advanced" scripting applications.

This does not change the existing logic at all and could easily be added, temporarily, since there's probably no overhaul in sight for these classes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment