Experimenting with Scala Worksheets
In the previous chapters, we had run the REPL as an interactive environment to experiment and get immediate feedback when entering the Scala syntax. This allowed us to very quickly write some small algorithms and get the right syntax to make things work. Although the SBT console provides programmers with a :replay
command to rerun what has already been written in the session, wouldn't it be nice to be able to save our experiments for later use, as part of our project ? This is exactly what Scala Worksheets are all about.
Scala Worksheet is an innovative feature of the Scala support for Eclipse that brings an interactive environment, that is, a REPL in the context of a project. This feature is also now available on the Scala support for IntelliJ.
Let's go to our small servlet sample in Eclipse to try it out.
To start a worksheet, right-click on any package or source file and navigate to New | Scala Worksheet (or if not present in the drop-down list, navigate...