This doesn't seem to behave correctly in the following case:
// LimitImports.scala
val res = 1
@
val asd = 1
// Foo.scala
import ammonite.ops._
load.module(wd/"LimitImports.scala")
@
println(res)
println(asd)
@ // Repl Session
@ import ammonite.ops._
@ load.module(wd/"Foo.scala")
ammonite.repl.CompilationError: Compilation Failed
Main.scala:174: not found: value res
println(res)
^
Main.scala:177: not found: value asd
println(asd)
^
ammonite.repl.interp.Interpreter.loop$1(Interpreter.scala:97)
ammonite.repl.interp.Interpreter.processScript(Interpreter.scala:86)
ammonite.repl.interp.Interpreter.processModule(Interpreter.scala:67)
ammonite.repl.interp.Interpreter$$anon$1$load$.module(Interpreter.scala:134)
cmd4$$anonfun$1.apply$mcV$sp(Main.scala:110)
cmd4$.<init>(Main.scala:111)
cmd4$.<clinit>(Main.scala:-1)
This should work. Will take some refactoring to make load.module put the imports in the right place depending on whether it's being called in a module or directly from the REPL, but shouldn't be hard in principle
This doesn't seem to behave correctly in the following case:
This should work. Will take some refactoring to make
load.moduleput the imports in the right place depending on whether it's being called in a module or directly from the REPL, but shouldn't be hard in principle