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

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

by Josh Suereth :: Rate this Message:

Reply to Author | View in Thread

I feel obligated to respond since I contributed the initial part of the REPL code for the current eclipse plugin (based on the previous plugin's REPL).

First off, I agree with you.  The REPL would be a great and distinguishing feature.

Here's what (IMHO) needs to be done:

  1. Migrate from my "Roll your own ProcessBuilder" to Eclipse's abstraction for executing Java processes.
    1. Make sure we don't lose control of potential syntax highlighting/code completion
    2. This should fix the windows/mac issues.  (Funny thing, I developed the initial REPL code on windows)
  2. Integrate JavaRebel as either an optional plugin or a configuration item
    1. The interpreter needs a Preference + Project Properties page
    2. We should get some help from the Lift/Maven plugin team (or anyone else who uses JavaRebel), as I don't make much use in my day-to-day programming.
  3. Ensure all "fun" keystrokes (tabs, arrows, etc.) get passed into the REPL process from eclipse
  4. Expand the "auto-import when opened from package" feature to include "auto-import projects"
    1. You'll need to expand the menu filters to include a filter for scala objects.  BTW this is where one of the "innocuous" error messages gets thrown form the scala plugin
  5. Integrate syntax highlighting/code completion
    1. Since the "console" is not a source editor, I'm not sure the regular eclipse APIs (DamageRepairer, etc.) work here. 
    2. I'm not as familiar with the Presentation compiler, so I can't articulate this task further, but I see it being fairly large

Just an FYI, the only REPL I've ever designed before was for the Eclipse LOLCode plugin.   Any help accomplishing the above would be MUCH appreciated (I'm currently slightly tied down with working on Scala/Maven integration with my copious free time).

Thanks,
-Josh



On Thu, Nov 13, 2008 at 6:06 AM, martin odersky <martin.odersky@...> wrote:
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?