Search code examples
kotlininteractiveread-eval-print-loop

Kotlin REPL deprecated?


When I type kotlin (or kotlinc) to get into the REPL interactive shell in the latest 2.1 beta, I see this:

Welcome to Kotlin version 2.1.0-Beta2 (JRE 21.0.4+8-LTS-274)
Warning: this REPL implementation is deprecated and will be removed soon.
Warning: REPL is not compatible with the Kotlin version 2.1.0-Beta2, using '-language-version 1.9'.
Type :help for help, :quit for quit

Will there be no official Kotlin interactive shell in the future?

If so, what should we use instead, if we just want to try some quick expression from the command line?

(The ki shell doesn't seem to be a core part of Kotlin and is only being maintained sporadically - last release was 0.5.2 in 2022.)


Solution

  • From what I found from YouTrack, KT-64384,

    The REPL will not be supported in K2 compiler, presumably at least until 2.1. Currently, the CLI REPL is switched to LV1.9 silently, and it may confuse some users. We should display a warning that LV1.9 is used instead of the default LV2.0.

    This confirms that the 2.0 compiler does not support the REPL. It suggests that there will be REPL support in some future version.