Do you mean exception in constructor?
# announcements
n
Do you mean exception in constructor?
d
No, I mean something like this:
Copy code
class Bar {

    val string: String

    constructor() {
        string = createString(this)
    }


}

fun createString(bar: Bar) = "abc"
You are leaking out an uninitialized reference to
Bar
in the constructor.
k
You can leak it right now to.
n
Cannot access '<this>' before superclass constructor has been called
d
It was an argument against doing "a lot of stuff" in constructors.
n
I understood, just wrote exact Kotlin’s error. 🙂
d
You get that if you try to use
this
inside the actual call to another constructor, yes.
My example actually compiles though 😉
n
Because your primary constructor has no params 🙂