BT

InfoQ Homepage News Kulla Project: A REPL for Java

Kulla Project: A REPL for Java

Bookmarks

A Java REPL will soon be coming to a JDK near you. Robert Field, engineer on the Langtools team at Oracle, recently proposed the creation of a Java REPL ("Read-Evaluate-Print-Loop") project. After a vote, the project, known as Project Kulla was approved.

A REPL is essentially a scripting shell or console, such as a UNIX shell or Groovy console, that can be used to obtain quick results, for example in algorithm exploration.

The corresponding JEP for Java's REPL states that a few items are out of scope: graphical interfaces, debugger support, and IDE-like functionality. The motivation is that immediate feedback is important when learning a programming languages, and due to that omission many schools are moving away from Java. Interactive evaluation is much more efficient than traditional edit/compile/execute. As stated in the JEP:

Without the ceremony of class "public static void main(String[] args) {", short scripts written in Java become practical.

Some currently available REPL alternatives for Java are:

According to its JEP, a Java REPL will be shipped with JDK 9. However, OpenJDK's JDK 9 does not list it as a feature.

Martin Odersky, founder of Scala, was recently asked what he thought about using REPL in Java. His response:

"The problem for Java here is that it is a fundamentally statement-oriented language. You write a statement, and when it executes, it has an effect. REPLs by contrast are expression-oriented: You write an expression, and the REPL shows the result, much like a calculator would. While a REPL is certainly possible for Java, it won't be as useful as for an expression-oriented language."

A REPL can become an essential part of learning a new language. It remains to be seen if its quick feedback will encourage novices to learn Java over other languages.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Would be useful to extend this to a script execution demon

    by Rüdiger Möller /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    What's missing is kind of "java as a scripting language",hich caches and compiles sript-java files on the fly without starting a full VM (just re-use global script-demon-vm). With some lambda-ization of File api, this would enable a java scripting language giving access to the huge amount of libraries and it is portable amongst OS'es.
    Also relax rules where classes can be defined (allow >1 public class per script-java file, no main method required).
    This would enable use of Java for adhoc tooling/scripting/small programs in a similar way to python.

  • Re: Would be useful to extend this to a script execution demon

    by David Dawson /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Check out Groovy, it's exactly as you described, plus loads more.

    Well, apart from the system daemon thing, that's something everyone in the JMV world is waiting for ....

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.