is it on purpose (and if so why) that I cannot use...
# dsl
d
is it on purpose (and if so why) that I cannot use the context object for assigning constructor default values, BUT I CAN use it in class init { } block???
Copy code
ctxObjs access does NOT work in constructor:

class CtxClass(val value: Int)

data class CtxStore(val ctxObjs: MutableMap<String, CtxClass> = mutableMapOf())

context(CtxStore)
class SomeClass(var ctxO: CtxClass = ctxObjs["someRef"]!!) { // <-- Unresolved reference: ctxObjs
    fun someFun() = "SomeClass(${ctxO.value})"
}
ctxObjs access does work in init block:
Copy code
class CtxClass(val value: Int)

data class CtxStore(val ctxObjs: MutableMap<String, CtxClass> = mutableMapOf())

context(CtxStore)
class SomeClass(var ctxO: CtxClass = CtxClass(0)) {
    init {
        ctxO = ctxObjs["someRef"]!!
    }
    fun someFun() = "SomeClass(${ctxO.value})"
}
e
Its a bug. Theres an open issue I’m sure you can find if you search “context” & “default” keywords