Is there an easy way to get the Scala REPL to reload a class or package?

Class reloading is not an easy problem. In fact, it's something that the JVM makes very difficult. You do have a couple options though.

Class reloading is not an easy problem. In fact, it's something that the JVM makes very difficult. You do have a couple options though: Start the Scala REPL in debug mode.

The JVM debugger has some built-in reloading which works on the method level. It won't help you with the case you gave, but it would handle something simple like changing a method implementation. Use JRebel (zeroturnaround.com/jrebel).

JRebel is basically a super-charged class reloading solution for the JVM. It can handle member addition/removal, new/removed classes, definition changes, etc. Just about the only thing it can't handle is changes in class hierarchy (adding a super-interface, for example). It's not a free tool, but they do offer a complementary license which is limited to Scala compilation units.

Unfortunately, both of these are limited by the Scala REPL's implementation details. I use JRebel, and it usually does the trick, but there are still cases where the REPL will not reflect the reloaded class(es). Still, it's better than nothing.

There is an alternative to reloading the class if the goal is to not have to repeat previous commands. The REPL has the command :replay which restarts the REPL environment and plays back all previous valid commands. (The invalid ones are skipped, so if it was wrong before, it won't suddenly work.) When the REPL is reset, it does reload classes, so new commands can use the contents of recompiled classes (in fact, the old commands will also use those recompiled classes).

This is not a general solution, but is a useful shortcut to extend an individual session with re-computable state.

Obviously bad for intensive sessions, but I like this. It also means you'll know if your changes broke anything, if testing/TDD is your aim. – Grogs Jan 6 at 5:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions