Suppose that I have the following piece of Kotlin code:
fun main(args: Array<String>) {
val a = "test"
println(args.first())
}
If I pass in an argument $a, the output is going to be $a. As I understand it Kotlin takes care of String templates by generating the code for the output on compilation, presumably using a StringBuilder. Is there some way to evaluate Strings that aren't in the source code with regards to templates in their current context? String templates are very useful and it'd be great to be capable of evaluating expressions that come from a dynamic context, such as configuration files, but as far as I can tell this can't be done.
Lacking that, what would be a good approach towards this? Invoking a scripting engine?