Gamar Mustafa
04/15/2024, 12:45 PMJacob
04/15/2024, 12:50 PMGamar Mustafa
04/15/2024, 1:04 PMCLOVIS
04/15/2024, 1:05 PMCLOVIS
04/15/2024, 1:09 PM// Module A
private val foo = 5
inline fun getFoo() = foo
and then where you use it:
// Module B
fun main() {
println(getFoo())
}
At compile-time, inline functions are removed; so this becomes:
// Mobule B
fun main() {
println(foo)
}
but foo
is private in modula A, so this is forbidden!Robert Jaros
04/15/2024, 1:15 PMfoo
variable is still there. I've always wondered why the compiler can't reference it in some hidden way?Gamar Mustafa
04/15/2024, 1:20 PMclass A{
inline fun test(a:() ->Unit){
a()
doSomething()
}
private fun doSomething(){
}
}
Jacob
04/15/2024, 1:21 PMGamar Mustafa
04/15/2024, 1:22 PMmain()
functionCLOVIS
04/15/2024, 2:34 PMCLOVIS
04/15/2024, 2:35 PMmain
function inside the same class? If so, you can make your function private.Robert Jaros
04/15/2024, 3:10 PM