Init block configuration depends on where it is declared
Example:
class Ark(vararg arguments: String) : Arkenv() {
init {
install(ProfileFeature())
parse(arguments.toList().toTypedArray())
}
val port: Int by argument("--port")
val name: String by argument("--name")
}
When placing parse
in the init block, declared before the arguments, it can cause weird behavior, because the delegates are not instantiated yet, when parsing occurs.
Edited by Andreas Volkmann