https://kotlinlang.org logo
#webassembly
Title
# webassembly
r

Robert Jaros

12/08/2023, 4:57 PM
I use
@Suppress("EXPECTED_EXTERNAL_DECLARATION")
a lot to overcome K/JS and K/Wasm incompatibilities with expect/actuals. How bad is this? 🙂
s

Svyatoslav Kuzmich [JB]

12/08/2023, 5:33 PM
Probably not great. Can’t confirm, but I can smell K2 issues when suppressing errors like this.
r

Robert Jaros

12/08/2023, 5:54 PM
I'm using K2 already
s

Svyatoslav Kuzmich [JB]

12/08/2023, 6:10 PM
This might work right now. But if it stops working later, Kotlin might not consider fixing it. Then, you’ll have to fix it yourself in your library and tell the people using your library to update it.
r

Robert Jaros

12/08/2023, 6:11 PM
Is there any particular reason to forbid expecting external type?
s

Svyatoslav Kuzmich [JB]

12/08/2023, 6:14 PM
None that I can think of. Could you file a ticket with the use-case so I can forward it to people working on expect-actual?
r

Robert Jaros

12/08/2023, 6:20 PM
I think this was forbidden within this issue: https://youtrack.jetbrains.com/issue/KT-58536/KMP-prohibit-expect-tailrec-expect-external, but there is no explanation why.
I'll file a new issue
After days of struggling with common code js/wasm incompatibilities, I have found this suppress code and my project gained a lot of readability and cohesion.
s

Svyatoslav Kuzmich [JB]

12/08/2023, 6:27 PM
I think you are right. A concrete YT-documented use-case from a real project would help us reconsider things.
s

Svyatoslav Kuzmich [JB]

12/08/2023, 6:39 PM
Thanks 🙏
r

Robert Jaros

12/08/2023, 6:40 PM
I'll add a link to my github code when I do some cleanups and commit.
2 Views