I have a very simple goal: to compile a Scala class, and then load it from within another Scala script. The problem is that Scala seems to cache (not sure where) the classes that I create, and doesn't respect subsequent changes.
The following lines create a directory with two .scala files, compiles one, and runs the other:
mkdir test
cd test
echo 'class MyClass(s: String)' > MyClass.scala
echo 'val p = new MyClass("ok")' > test.scala
scalac MyClass.scala
scala test.scala # this works
cd ..
rm -rf test
If I run the above lines, I need to REBOOT MY COMPUTER for the lines below to work:
mkdir test
cd test
echo 'class MyClass()' > MyClass.scala
echo 'val p = new MyClass()' > test.scala
scalac MyClass.scala
scala test.scala # this doesn't
cd ..
rm -rf test
If I don't reboot, I get an error that I'm missing a String in my constructor. Not sure where in Scala-land it's caching the previous String-based constructor.