Hi folks, the kotlin scripting keep mentions scrip...
# scripting
l
Hi folks, the kotlin scripting keep mentions script-based dsl (https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md#script-based-dsl). Is this possible in the current version? If so, is there a sample project?
i
It is possible in the current version too. I cannot recommend yet any sample project that implements exactly this scenario, but maybe others can.
l
Alright, I've managed to compile my script into a class. Now is there a better way to get a script result than reflecting on the $$result field?
If someone comes across this later: Here's my project https://github.com/F43nd1r/liquibase-kotlin-dsl maybe it'll help although it's no minimal sample.
i
is there a better way to get a script result than reflecting on the $$result field?
I'm afraid - not by much. You can configure the result field name with the configuration's
resultField
property. But I guess that if you'll set it to some existing field e.g. in the base class - you'll get an error. If you happen to try it out, pleas file an issue in YouTrack.
Cool project, btw, thanks for sharing. Would you mind, if I'll link it from https://github.com/Kotlin/kotlin-script-examples ?
l
But I guess that if you'll set it to some existing field e.g. in the base class - you'll get an error. If you happen to try it out, pleas file an issue in YouTrack.
I've tried using an existing field. It doesn't throw an error, but the compiled script doesn't use the existing field. I've created an issue here https://youtrack.jetbrains.com/issue/KT-41258
Would you mind, if I'll link it
Sure, go ahead.
👍 1
e
I cannot recommend yet any sample project that implements exactly this scenario, but maybe others can
Maybe this is a good time to self plug my project that does this 🙈 https://github.com/efemoney/ussd-toolbox.
i
@efemoney, looks nice! I'd be glad to link it to the Kotlin Script Examples repo, if you don't mind. But I'd need a short description, the in your repo is quite economic. 🙂
e
I'll update the README.md and drop a description here.