spxbhuhb / adaptive

Consolidated full-stack application development library for Kotlin
https://adaptive.fun
Apache License 2.0
3 stars 0 forks source link

function closure variables with adaptive entry point #1

Open toth-istvan-zoltan opened 4 months ago

toth-istvan-zoltan commented 4 months ago

This results in a compiler error:

fun a() {
    val i = 12
    adaptive(TestAdapter()) {
        T1(i)
    }
}

This works OK:

val i1 = 12
fun a() {
    adaptive(TestAdapter()) {
        T1(i1)
    }
}

The problem is the function scope which is something complicated I think as there may be other, non-adaptive players who change the value of the variable.

Maybe the best solution would be to generate a compilation error in this case.