sdeleuze
02/25/2023, 4:40 PMfun main() {
window.onload = { document.body?.sayHello() }
}
With Kotlin/Wasm, I need to write:
fun main() {
window.onload = {
document.body?.sayHello()
null
}
}
To make it compile.Svyatoslav Kuzmich [JB]
02/26/2023, 8:07 AMdynamic
in K/Wasm. These lambda types are generated from EventHandler IDL and it seems that return value can be used to cancel the event. I agree that most of the time we don’t need to return anything and having to put null
is inconvenient. We’ll see what can be done.sdeleuze
02/26/2023, 10:18 AMdynamic
with Wasm but I am a bit confused by the fact asDynamic()
can be invoked. Is it just returning this
or is it a noop operation currently?
Maybe you did this temporarily for better compat with Kotlin/JS?
Would that make sense to ensure it is not used at compile time to avoid any confusion like the one I had when porting kotlinx-html (silent failure)?Svyatoslav Kuzmich [JB]
02/26/2023, 10:25 AMasDynamic()
wasm a temporarily stub to make our code ported from Kotlin/JS compile and run in some cases. It usually works as as
, but it is overloaded for String
where it converts Kotlin String to JS.
We should probably drop it from stdlib, please don’t use it.sdeleuze
02/26/2023, 10:27 AM