I am not sure whether I should put it here on IDEA discussion, but since it is kotlin-specific, I will try here first.
I am using kotlin for some simulation and data analysis so sometimes I want to work right from IDE without building the project first. I can easily do it with gradle tasks or by creating main function in a file, but it requires additional body movements which I do not like. When I am working with Groovy, I just create a script file and execute it in IDE.
Kotlin also supports scripting and even REPL inside IDE.
The problem is that script does not seems to have access to other project classes. Its classpath does not include build directory. Is it intended to be like this? And, by the way, it for some reason changes encoding to system default instead of project default (which is probably a bug).
REPL inside IDE is a great thing, but it seems to be unstable, since it throws some vague NoClassDefFoundError when using kotlin global functions.
What about support for standalone live JVM REPL just to explore the language itself like JShell? Does anything like that exist currently that you know of? If not I’m really tempted to hack together something on top of the jdk.jshell API just for fun
I don’t mean anything official but a 3rd party fork maybe. I’ve tried kotlinc CLI tool and it’s not very interactive and doesn’t promote exploratory programming because it’s not like a live jvm process that it compiles against and runs in like jshell. Try out jshell if you haven’t, it’s a bit akward but super powerful once you get the hang of it.
It’s nice if you want to test something in your existing code really quickly with a one liner or whatever. Jshell exposes an interface on the SPI for hotswapping types and whatnot so I don’t thing it’d be that difficult to implement. Was just curious for myself I guess, not requesting someone else to do it Kotlinc makes understanding javac look like a walk in the park though, especially since source & building the language tools isn’t documented
You can always call kotlin classes from JShell or GroovyShell. But I agree, more powerful REPL engine would be good. In my case, I want to be able to embed the REPL inside my own code like I do it with GroovyShell.