Mention Groovy / Scala REPLs in the JEP?
Thibault Kruse
tibokruse at googlemail.com
Sun Aug 9 21:52:28 UTC 2015
Hi,
I was involved as a developer in improving the Groovy REPL 'groovysh'
(http://www.groovy-lang.org/groovysh.html) over the last 2 years (in
particular improving tab completion).
I just read JEP-222 and noticed it does not mention the Groovy and
Scala REPLs, even though those both allow interacting with Java
classes (with Groovy accepting a syntax somewhat similar to Java).
I thought it might be useful for context to mention them in the JEP
(their features may be more relevant than those of BeanShell).
Also it might be useful to compare those REPLs features with JShell
features to see whether something is missing. In particular the
command line options, and the meta-commands are probably useful to
look at.
I don't know the planned JShell feature set, so here are just some of
the Groovy REPs features to consider.
- Auto-Indentation: Same as any IDE, after opening braces
- Coloring of syntax or output
- tab-completion of imports (requires classpath scanning)
- command :show (:S ) Show variables, classes or imports
- command :inspect (:n ) Inspect a variable or the last result with
the GUI object browser
- command :edit (:e ) Edit the current buffer in proper editor
(like vi, emacs)
- command :load (:l ) Load a file or URL into the buffer
- command :save (:s ) Save the current buffer to a file
- command :set (:= ) Set (or list) preferences
- command :doc (:D ) Opens a browser window displaying the doc
for the argument
- Custom commands: For people building custom DSLs or creating
potential future JShell features
- integration of a dependency resolution (download jar from the web
and load), in groovysh via Grape
- Starting the REPL with a custom file (pre-populating often-used variables)
I am not familiar enough with the Scala REPL to compare.
I am also maintaining a gradle plugin to start the groovy REPL with
the projects classes and dependencies on the classpath. While that is
beyond the scope of core JShell, such plugins for gradle and maven
could help JShells success.
Also noteworthy for inspiration could be the Python REPL iPython
(http://pythoncentral.io/review-of-ipython-alternative-python-shell/)
Finally, let me just mention that the groovy shell also uses jline2,
and that jline2 has a recent increase of activity in July2015, so it
might be good to keep an eye out for the changes:
https://www.openhub.net/p/jline
In particular it seems they fixed problems I had with providing
color-coded tab completion (e.g. showing static methods as candidates
in a different style than non-statics).
regards,
Thibault
More information about the kulla-dev
mailing list