We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reminder to fix.
scala> new IMain.Factory res2: scala.tools.nsc.interpreter.IMain.Factory = scala.tools.nsc.interpreter.IMain$Factory@352b9aeb scala> .getScriptEngine res3: javax.script.ScriptEngine = scala.tools.nsc.interpreter.IMain@7505d7e7 scala> .asInstanceOf[Compilable] res4: javax.script.Compilable = scala.tools.nsc.interpreter.IMain@7505d7e7 scala> .compile("val foo = 8") res5: javax.script.CompiledScript = scala.tools.nsc.interpreter.IMain$WrappedRequest@749ccfd1 scala> .eval res6: Object = 8 scala> res4 compile """println("hello") ; val bar = 8""" res7: javax.script.CompiledScript = scala.tools.nsc.interpreter.IMain$WrappedRequest@7772d5dd scala> res7.eval hello res8: Object = 8 scala> res7.eval res9: Object = 8
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-7933?orig=1 Reporter: @som-snytt
Sorry, something went wrong.
@rjolly said: Attempted solution in scala/scala#3433
@som-snytt said: This means compile and eval have different semantics with respect to REPL history:
scala> val e = engine.asInstanceOf[ScriptEngine with Compilable] e: javax.script.ScriptEngine with javax.script.Compilable = scala.tools.nsc.interpreter.IMain@1f28c152 scala> val s = e.compile("val x = 42") s: javax.script.CompiledScript = $anon$1@4e423aa2 scala> s.eval() res0: Object = () scala> e.eval("x") <console>:11: error: not found: value x x ^ javax.script.ScriptException: compile-time error at scala.tools.nsc.interpreter.IMain.compiled(IMain.scala:600) at scala.tools.nsc.interpreter.IMain.eval(IMain.scala:1066) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) ... 33 elided scala> e.eval("val x = 42") res2: Object = 42 scala> e.eval("x") res3: Object = 42
rjolly
No branches or pull requests
Reminder to fix.
The text was updated successfully, but these errors were encountered: