« Return to Thread: [scala-tools] Can we improve the Eclipse REPL?

[scala-tools] Can we improve the Eclipse REPL?

by Martin Odersky :: Rate this Message:

Reply to Author | View in Thread

I am teaching functional programming in Scala to a class of 2nd year
students. I am doing a lot of demonstrations directly, showing the
students the behavior of various language constructs, inviting
improvement proposals, etc. This works generally very well. One
annoying thing is that I have been flip-flopping constantly between
the eclipse plugin and the command line interpreter. Both have
strengths and weaknesses. The plugin is great for developing and
incrementally improving a set of classes. The REPL is great for
free-form experimentation and exploration. This made me really wish we
could combine the strengths of the two.

Ideally what I would wish for is the following:

 - being able to open a REPL with a given focus. Say I open a REPL for
element mypackage.myobject. Then I want automatic
   imports:

     import mypackage._
     import myobject._

   so that I can directly access definitions in my focus and its environment.

  - when I change code, the REPL should automatically re-load it. I
think this can be achieved using JavaRebel, but don't know enough
about it yet.
    If we don't want to rely on JavaRebel, one could also imagine to
re-load only if the focus file is changed. This could be done by
wrapping the focus
    file in a synthetic version object, which gets changed everytime
we edit he focus file. So we end up with many versions of the same
class(es),
    each wrapped in a different version object.

The current console support does neither (and, besides, it does not
work on Windows; the console window closes immediately after being
opened).

I believe if we can do such a thing, it would be really useful. It
would be a point where the Scala plugin would do something clearly
better than the
Java plugin. For the first time, we'd do more than catching up!


Cheers

 -- Martin

 « Return to Thread: [scala-tools] Can we improve the Eclipse REPL?