Programmers could get REPL in official Java

Featured in Lisp programming, REPL expressions cut compilation overhead in looping operations

Proponents of open source Java are investigating the possibility of formally adding a REPL (Read Evaluate Print Loop) tool to the language.

Java advocates are considering REPL as part of Project Kulla, currently under discussion on the openjdk mailing list for open source Java. Featured in Lisp programming, REPL expressions replace entire compilation units; the REPL evaluates them and offers results. With REPL, the overhead of compilation is avoided for looping operations, says Forrester analyst John Rymer.

"From a developer perspective, it's nice to be able to interact with the code while it's running in real time without having to recompile/redeploy," analyst Michael Facemire, also of Forrester, says.

REPLs already are featured in most dynamic and functional languages, including Scala, says Scala founder Martin Odersky in an email. There have even been REPLs available for Java before, he says. A Java REPL implementation has been available online and forkable on GitHub.

But Odersky sees limits with using REPL in Java. "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," he says. "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."

Facemire, however, expects REPL to "be in vogue before you know it," with new languages like Apple's Swift supporting it.

Code cloned from the Java Development Kit 9 repository would be featured in Project Kulla. Votes on the proposal are being taken on the mailing list until Sept. 10. Oracle technologists familiar with the proposal did not respond to an inquiry on Tuesday.

This story, "Programmers could get REPL in official Java" was originally published by InfoWorld.