Huh, no forward knot tying or whatever it's called...
# compiler
r
Huh, no forward knot tying or whatever it's called with mutually recursive functions inside a body?
Copy code
setContent {
  ...
  suspend fun func1() {
    func2()
  }
  suspend fun func2() {
    func1()
  }
}
Tells me
func2
isn't defined in
func1
d
Compiler adds local functions to scope only after their declaration There is no difference with local properties
Copy code
...
val x = y // y is not defined
val y = x
...
y
Copy code
setContent {
  ...
  suspend fun func1(func2: suspend () -> Unit) {
    func2()
  }
  suspend fun func2() {
    func1(::func2)
  }
  suspend fun func1() = func1(::func2)
}
That should do the trick! It's kinda inspired by Y-combinators from Lambda Calculus
r
That's what I did in the end ^^