Answering to <@U0CP8EBRV> questions in <#C0922A726...
# scripting
i
Answering to @Czar questions in #general: https://kotlinlang.slack.com/archives/C0922A726/p1505979403000389 https://kotlinlang.slack.com/archives/C0922A726/p1505981342000114 The kotlin compiler is a complex beast with many dependencies, so you will probably need an isolation from your application in some way. Of course we intend to do this isolation easier by providing specific wrappers, but unfortunately we’re not there yet. But if you’re still willing to continue the experiment, there are two ways: First you may try to continue the route with embeddable compiler, but load the scripting part in a classloader which will filter the conflicting dependencies. And second - you may try to use compilation in daemon. If you’re using JSR223 interfaces, then you may simply try to start from this example - https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-daemon-local-eval-example. If you’re trying more low-level approach, then you may look at this class https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-script-util/src/main/kotlin/org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmDaemonCompileScriptEngine.kt#L39as a starting point. The problem with warning about the runtime is not related to the isolation, and we’re working on the fix now.
c
Thanks, interesting suggestions. Initially I hoped for a much simpler solution, for groovy it's one simple class with 20 lines of code. With Kotlin it seems much more time-consuming. I'll probably tinker with it in my spare time though. I'll report back if and when I have some updates.
i
Yep, it is not easy enough yet. But we’re working on improved scripting support, So hopefully it will be at least as simple as with groovy some day.