I wonder if it's possible to use kotlin script for...
# scripting
e
I wonder if it's possible to use kotlin script for type safe declarative configuration for newbie users that is: a user is supposed to open a given
kts
file in his Idea and fill out the fields of a class (or whatever) and nothing more is this something possible?
d
What are you imagining the kts file looks like?
p
I'm also wondering what you mean by "newbie users" - do they even know how to code? Or is it about their lack of knowledge about a particular domain?
e
I imagine kind of like a declarative DSL
users are reasearcher/phd who aren't coder by profession
p
so why do you want it to be a Kotlin script? Are the class's fields simple values or also e.g. functions/lambdas? I'm thinking if a simple configuration language would be more proper. E.g. YAML together with a proper schema (they're supported in IntelliJ) does the job. I think I'd need more info to advise further
e
because I hope it would be possible to enforce/apply somehow that via the script definition and host
I'd love a statically typed language
p
do you need the versatility of the statically typed language? is it meant to cover some possible future use cases?
for very basic use cases, YAML and Kotlin with IntelliJ provide similar functionality, e.g. suggesting what fields to add, what's their type, possible values, and so on. Once you start thinking about some more complex scenarios, e.g. avoiding duplication of some values, YAML still gives you e.g. anchors and aliases, but they are a rudimentary way to handle it
e
the context is to create a template to fill the metadata (Gradle and more) for scijava plugin developers
p
so a researcher requests the plugin developers to create a plugin for him, right? does it need to be in a form of a file, and not e.g. a Google Forms form? (just asking to further understand the reqs)
is it the number of created plugins so high to automate this step? will it pay off?
sorry if I went too far: answering your very first question, I think it's possible. but I'm personally not sure if it's worth going this path
e
I'm glad to go far, if needed here you can see, under "Required metadata", some of the info he needs to fill moreover, they should also be enforced (ie the build should fails if they aren't defined), I was kind of hoping to catch two birds with a stone there..
there are literally several thousands of plugins, so it's surely worth it (although right now all mostly Maven based)