I mean I can imagine API is changed but what about...
# scripting
e
I mean I can imagine API is changed but what about dropping it completely?
i
It is still experimental, yes. And will probably remain in this status for a while. I do not believe we can drop it in the foreseeable future, even if we want to. There are some commitments already. However, we do not have enough resources and motivation to bring it to the a fully supported state at the moment.
p
@ilya.chernikov is it also the case (no resources or motivation) with built-in script defs like
.main.kts
? I'm really hoping and looking forward to getting some long-standing issues fixed, mainly because they impair usage and further development of github-workflows-kt that relies on
.main.kts
i
Which particular issues are most annoying for you? In general,
main-kts
is intended to be a demo of a custom script definition and scripting API usage, so we are not committed to make a stable product out of it at the moment. It is important for us to keep the underlying scripting API solid though.
p
i
Ok, I see. They are quite tough ones for a number of reasons. But we're keeping them in mind, so there are good chances that they will be solved eventually. Sorry, I cannot give a better estimates at the moment.
👍 1
p
got it, thanks! maybe it's valuable: when I sometimes introduce new folks to Kotlin, I like to show them Scripting first as a way to start with Kotlin in a lightweight way (no Gradle or complicated dir structure, just a single file). They like it, but once we stumble upon one of the bugs, I need to explain them it's just about scripting, not Kotlin in general, and they are a bit disappointed. So just FYI, it does influence Kotlin's reputation overall
i
I understand. But unfortunately we failed to find out a good educational story for scripting, so this is still considered a marginally useful case. cc: @Anton Yalyshev [JB]
p
perhaps the story I mentioned ("a lightweight start with Kotlin") would be useful here 🙂 it proved to work several times
e
Maybe offtopic - Piotr, what about REPL, maybe people can just use online editor for playing with things?
p
for experimenting yes, but I used Kotlin Scripting to write simple automations and show it to my colleagues, in place of bash/Python. it's a bit different use case. We actually store the scripts in a repo
d
For these types of bugs, do you guys tend to accept pull-requests for fixes?
i
@Daniel Pitts, in general - yes, we're always glad to see contributions. But as I wrote above, these in particular are quite difficult. E.g., the "stale cache" ones - to fix it properly one need to do a significant script compilation pipeline changes, which we're planning to do eventually, but plans are quite vague there. Although if someone figures out some not too dirty hack to workaround it in the current code, that could be accepted too. And the other two issues are about IDE plugin, which is being revamped right now, so making changes there on top of the old infrastructure hardly makes sense.
👍 1
k
In Kotlin 2.0.0 scripting seems to be broken, did anyone had similar issues? I can't even evaluate 1+1
p
@Kedar what error do you get?
k
2024-06-19T182028.488+05:30 ERROR --- [ Test worker] c.b.k.s.p.jvm.JVMScriptingProviderImpl : org.jetbrains.kotlin.util.FileAnalysisException: Somewhere in file stringSource.kts: java.lang.NullPointerException: null at org.jetbrains.kotlin.util.AnalysisExceptionsKt.wrapIntoFileAnalysisExceptionIfNeeded(AnalysisExceptions.kt:62) at org.jetbrains.kotlin.fir.FirCliExceptionHandler.handleExceptionOnFileAnalysis(Utils.kt:180) at org.jetbrains.kotlin.fir.resolve.transformers.FirAbstractPhaseTransformer.transformFile(FirAbstractPhaseTransformer.kt:45) at org.jetbrains.kotlin.fir.resolve.transformers.FirTypeResolveTransformer.access$transformFile$s2121775402(FirTypeResolveTransformer.kt:65) at org.jetbrains.kotlin.fir.resolve.transformers.FirTypeResolveTransformer.transformFile(FirTypeResolveTransformer.kt:111) at org.jetbrains.kotlin.fir.declarations.FirFile.transform(FirFile.kt:46) at org.jetbrains.kotlin.fir.resolve.transformers.FirTransformerBasedResolveProcessor.processFile(FirResolveProcessor.kt:48) at org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor.process(FirTotalResolveProcessor.kt:36) at org.jetbrains.kotlin.fir.pipeline.AnalyseKt.runResolution(analyse.kt:20) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerImplsKt.doCompileWithK2(ScriptJvmCompilerImpls.kt:423) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerImplsKt.compileImpl(ScriptJvmCompilerImpls.kt:185) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerImplsKt.access$compileImpl(ScriptJvmCompilerImpls.kt:1) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerIsolated.compile$lambda$2$lambda$1(ScriptJvmCompilerImpls.kt:72) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerImplsKt.withScriptCompilationCache(ScriptJvmCompilerImpls.kt:117) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerImplsKt.access$withScriptCompilationCache(ScriptJvmCompilerImpls.kt:1) at org.jetbrains.kotlin.scripting.compiler.plugin.impl.ScriptJvmCompilerIsolated.compile(ScriptJvmCompilerImpls.kt:63) at kotlin.script.experimental.jvmhost.JvmScriptCompiler.invoke$suspendImpl(jvmScriptCompilation.kt:30) at kotlin.script.experimental.jvmhost.JvmScriptCompiler.invoke(jvmScriptCompilation.kt) at kotlin.script.experimental.host.BasicScriptingHost$eval$1.invokeSuspend(BasicScriptingHost.kt:47) at kotlin.script.experimental.host.BasicScriptingHost$eval$1.invoke(BasicScriptingHost.kt) at kotlin.script.experimental.host.BasicScriptingHost$eval$1.invoke(BasicScriptingHost.kt) at kotlin.script.experimental.host.BasicScriptingHost$runInCoroutineContext$1.invokeSuspend(BasicScriptingHost.kt:36) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115) at kotlin.script.experimental.impl.RunSuspendKt.internalScriptingRunSuspend(runSuspend.kt:19) at kotlin.script.experimental.host.BasicScriptingHost.runInCoroutineContext(BasicScriptingHost.kt:36) at kotlin.script.experimental.host.BasicScriptingHost.eval(BasicScriptingHost.kt:46) at com.bancbridge.kwantum.scripting.provider.jvm.JVMScriptingProviderImpl.evaluation(JVMScriptingProviderImpl.kt:34) at com.bancbridge.kwantum.scripting.provider.jvm.JVMScriptingProviderImpl.evaluate(JVMScriptingProviderImpl.kt:22) at com.bancbridge.kwantum.scripting.provider.jvm.JVMScriptingProviderImplTest.test(JVMScriptingProviderImplTest.kt:32)
Simple script val evaluationConfiguration = ScriptEvaluationConfiguration { providedProperties("bindings" to mutableMapOf("name" to "Kedar") ) } val resultWithDiagnostics = basicJvmScriptingHost.eval("\"Hello\"".toScriptSource(), compilationConfiguration, evaluationConfiguration) CompilationConfiguration/Evaluation are basic ones from example on the scripting site
If I remove providedProperties it works.