class
SparkIMain extends SparkImports with Logging
Instance Constructors
-
new
SparkIMain()
-
new
SparkIMain(settings: Settings)
-
new
SparkIMain(initialSettings: Settings, out: JPrintWriter)
Type Members
-
-
-
-
case class
SparkComputedImports(prepend: String, append: String, access: String) extends Product with Serializable
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
-
val
SPARK_DEBUG_REPL: Boolean
-
def
addImports(ids: String*): Result
-
def
aliasForType(path: String): Option[String]
-
def
allDefHandlers: List[(memberHandlers)#MemberDefHandler]
-
def
allDefSymbols: List[scala.tools.nsc.Global.Symbol]
-
def
allDefinedNames: List[scala.tools.nsc.Global.Name]
-
def
allHandlers: List[(memberHandlers)#MemberHandler]
-
def
allImplicits: List[scala.tools.nsc.Global.Name { ... /* 5 definitions in type refinement */ }]
-
def
allImportedNames: List[scala.tools.nsc.Global.Name]
-
def
allSeenTypes: List[String]
-
def
apply[T](implicit arg0: ClassTag[T]): scala.tools.nsc.Global.Symbol
-
def
apply(name: String): scala.tools.nsc.Global.Symbol
-
final
def
asInstanceOf[T0]: T0
-
def
beQuietDuring[T](body: ⇒ T): T
-
def
beSilentDuring[T](operation: ⇒ T): T
-
def
bind[T](name: String, value: T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): Result
-
def
bind(p: NamedParam): Result
-
def
bind(name: String, boundType: String, value: Any, modifiers: List[String] = Nil): Result
-
def
bindSyntheticValue(x: Any): Result
-
def
bindValue(name: String, x: Any): Result
-
def
bindValue(x: Any): Result
-
def
classLoader: AbstractFileClassLoader
-
def
classOfTerm(id: String): Option[JClass]
-
val
classServer: HttpServer
-
def
classSymbols: List[scala.tools.nsc.Global.ClassSymbol]
-
def
cleanMemberDecl(owner: scala.tools.nsc.Global.Symbol, member: scala.tools.nsc.Global.Name): scala.tools.nsc.Global.Type
-
def
clearExecutionWrapper(): Unit
-
def
clone(): AnyRef
-
def
close(): Unit
-
def
compileSources(sources: SourceFile*): Boolean
-
def
compileSourcesKeepingRun(sources: SourceFile*): (Boolean, Run)
-
def
compileString(code: String): Boolean
-
def
compilerClasspath: Seq[URL]
-
val
conf: SparkConf
-
def
debugging[T](msg: String)(res: T): T
-
object
deconstruct extends StructuredTypeStrings
-
def
definedSymbolList: List[scala.tools.nsc.Global.Symbol]
-
def
definedSymbols: Set[scala.tools.nsc.Global.Symbol]
-
def
definedTerms: List[scala.tools.nsc.Global.TermName]
-
def
definedTypes: List[scala.tools.nsc.Global.TypeName]
-
def
definitionForName(name: scala.tools.nsc.Global.Name): Option[(memberHandlers)#MemberHandler]
-
def
directBind[T](name: String, value: T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): Result
-
def
directBind(p: NamedParam): Result
-
def
directBind(name: String, boundType: String, value: Any): Result
-
final
def
ensureClassLoader(): Unit
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
executionWrapper: String
-
-
def
finalize(): Unit
-
def
flatName(id: String): String
-
lazy val
formatting: Formatting
-
def
generatedName(simpleName: String): Option[String]
-
final
def
getClass(): Class[_]
-
def
getInterpreterClassLoader(): AbstractFileClassLoader
-
lazy val
global: Global
-
def
handleTermRedefinition(name: scala.tools.nsc.Global.TermName, old: Request, req: Request): Unit
-
def
handleTypeRedefinition(name: scala.tools.nsc.Global.TypeName, old: Request, req: Request): Unit
-
def
hashCode(): Int
-
def
implicitSymbols: List[scala.tools.nsc.Global.Symbol]
-
def
implicitSymbolsBySource: List[(scala.tools.nsc.Global.Symbol, List[scala.tools.nsc.Global.Symbol])]
-
def
importHandlers: List[(memberHandlers)#ImportHandler]
-
def
importedSymbols: List[scala.tools.nsc.Global.Symbol]
-
def
importedSymbolsBySource: List[(scala.tools.nsc.Global.Symbol, List[scala.tools.nsc.Global.Symbol])]
-
def
importedTermNamed(name: String): scala.tools.nsc.Global.Symbol
-
def
importedTermSymbols: List[scala.tools.nsc.Global.TermSymbol]
-
def
importedTerms: List[scala.tools.nsc.Global.TermName]
-
def
importedTypeSymbols: List[scala.tools.nsc.Global.TypeSymbol]
-
def
importedTypes: List[scala.tools.nsc.Global.TypeName]
-
def
importsCode(wanted: Set[scala.tools.nsc.Global.Name]): SparkComputedImports
-
def
initialize(postInitSignal: ⇒ Unit): Unit
-
def
initializeSynchronous(): Unit
-
def
interpret(line: String, synthetic: Boolean): Result
-
def
interpret(line: String): Result
-
def
interpretSynthetic(line: String): Result
-
def
isInitializeComplete: Boolean
-
final
def
isInstanceOf[T0]: Boolean
-
def
isNoImports: Boolean
-
def
isNoPredef: Boolean
-
def
isParseable(line: String): Boolean
-
def
isTraceEnabled(): Boolean
-
-
def
languageSymbols: List[scala.tools.nsc.Global.Symbol]
-
def
languageWildcardHandlers: List[(memberHandlers)#ImportHandler]
-
def
languageWildcardSyms: List[scala.tools.nsc.Global.Symbol]
-
def
languageWildcards: List[scala.tools.nsc.Global.Type]
-
def
lastRequest: Request
-
def
lastWarnings: List[(scala.tools.nsc.Global.Position, String)]
-
def
log: Logger
-
def
logDebug(msg: ⇒ String, throwable: Throwable): Unit
-
def
logDebug(msg: ⇒ String): Unit
-
def
logError(msg: ⇒ String, throwable: Throwable): Unit
-
def
logError(msg: ⇒ String): Unit
-
def
logInfo(msg: ⇒ String, throwable: Throwable): Unit
-
def
logInfo(msg: ⇒ String): Unit
-
def
logTrace(msg: ⇒ String, throwable: Throwable): Unit
-
def
logTrace(msg: ⇒ String): Unit
-
def
logWarning(msg: ⇒ String, throwable: Throwable): Unit
-
def
logWarning(msg: ⇒ String): Unit
-
lazy val
memberHandlers: SparkMemberHandlers { val intp: SparkIMain.this.type }
-
def
methodSymbols: List[scala.tools.nsc.Global.MethodSymbol]
-
def
mostRecentLine: String
-
def
mostRecentVar: String
-
def
namedDefinedTerms: List[scala.tools.nsc.Global.TermName]
-
object
naming extends Naming
-
final
def
ne(arg0: AnyRef): Boolean
-
def
newCompiler(settings: Settings, reporter: Reporter): ReplGlobal
-
def
normalizeNonPublic(tp: scala.tools.nsc.Global.Type): scala.tools.nsc.Global.Type
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
onlyTerms(xs: List[scala.tools.nsc.Global.Name]): List[scala.tools.nsc.Global.TermName]
-
def
onlyTypes(xs: List[scala.tools.nsc.Global.Name]): List[scala.tools.nsc.Global.TypeName]
-
def
optFlatName(id: String): Option[String]
-
-
lazy val
outputDir: File
-
def
parentClassLoader: ClassLoader
-
def
parse(line: String): Option[List[scala.tools.nsc.Global.Tree]]
-
def
pathToName(name: scala.tools.nsc.Global.Name): String
-
def
pathToTerm(id: String): String
-
def
pathToType(id: String): String
-
def
prevRequestList: List[Request]
-
var
printResults: Boolean
-
def
quietBind(p: NamedParam): Result
-
def
quietImport(ids: String*): Result
-
def
quietRun[T](code: String): Result
-
def
rebind(p: NamedParam): Result
-
def
recordRequest(req: Request): Unit
-
lazy val
repllog: Logger
-
def
replwarn(msg: ⇒ String): Unit
-
lazy val
reporter: ConsoleReporter
-
def
requestForIdent(line: String): Option[Request]
-
def
requestForName(name: scala.tools.nsc.Global.Name): Option[Request]
-
def
requestForReqId(id: Int): Option[Request]
-
def
requestHistoryForName(name: scala.tools.nsc.Global.Name): List[Request]
-
def
reset(): Unit
-
def
resetClassLoader(): Unit
-
def
runtimeClassAndTypeOfTerm(id: String): Option[(JClass, scala.tools.nsc.Global.Type)]
-
def
runtimeTypeOfTerm(id: String): scala.tools.nsc.Global.Type
-
def
sessionImportedSymbols: List[scala.tools.nsc.Global.Symbol]
-
def
sessionWildcards: List[scala.tools.nsc.Global.Type]
-
def
setContextClassLoader(): Unit
-
def
setExecutionWrapper(code: String): Unit
-
def
settings: Settings
-
def
showCodeIfDebugging(code: String): Unit
-
def
symbolDefString(sym: scala.tools.nsc.Global.Symbol): String
-
def
symbolOfLine(code: String): scala.tools.nsc.Global.Symbol
-
def
symbolOfTerm(id: String): scala.tools.nsc.Global.Symbol
-
def
symbolOfType(id: String): scala.tools.nsc.Global.Symbol
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
terms[T](implicit arg0: ClassTag[T]): scala.tools.nsc.Global.Symbol
-
def
terms(name: String): scala.tools.nsc.Global.Symbol
-
def
toString(): String
-
var
totalSilence: Boolean
-
def
treesForRequestId(id: Int): List[scala.tools.nsc.Global.Tree]
-
def
typeOfExpression(expr: String, silent: Boolean = true): scala.tools.nsc.Global.Type
-
def
typeOfTerm(id: String): scala.tools.nsc.Global.Type
-
def
types[T](implicit arg0: ClassTag[T]): scala.tools.nsc.Global.Symbol
-
def
types(name: String): scala.tools.nsc.Global.Symbol
-
def
unqualifiedIds: List[String]
-
def
valueOfTerm(id: String): Option[AnyRef]
-
val
virtualDirectory: PlainFile
-
def
visibleTermNames: List[scala.tools.nsc.Global.Name]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
wildcardTypes: List[scala.tools.nsc.Global.Type]
-
def
withoutUnwrapping(op: ⇒ Unit): Unit
-
def
withoutWarnings[T](body: ⇒ T): T
Deprecated Value Members
-
lazy val
compiler: global.type
Inherited from Logging
Inherited from Any
An interpreter for Scala code.
The main public entry points are compile(), interpret(), and bind(). The compile() method loads a complete Scala file. The interpret() method executes one line of Scala code at the request of the user. The bind() method binds an object to a variable that can then be used by later interpreted code.
The overall approach is based on compiling the requested code and then using a Java classloader and Java reflection to run the code and access its results.
In more detail, a single compiler instance is used to accumulate all successfully compiled or interpreted Scala code. To "interpret" a line of code, the compiler generates a fresh object that includes the line of code and which has public member(s) to export all variables defined by that code. To extract the result of an interpreted line to show the user, a second "result object" is created which imports the variables exported by the above object and then exports members called "$eval" and "$print". To accomodate user expressions that read from variables or methods defined in previous statements, "import" statements are used.
This interpreter shares the strengths and weaknesses of using the full compiler-to-Java. The main strength is that interpreted code behaves exactly as does compiled code, including running at full speed. The main weakness is that redefining classes and methods is not handled properly, because rebinding at the Java level is technically difficult.