diff --git a/docs/topics/wasm/wasm-configuration.md b/docs/topics/wasm/wasm-configuration.md index 996a35dbe53..7c1a13cbe07 100644 --- a/docs/topics/wasm/wasm-configuration.md +++ b/docs/topics/wasm/wasm-configuration.md @@ -88,15 +88,24 @@ For this reason, we strongly recommend that you update your Wasm projects to the ### Exception handling proposal -The Kotlin toolchain uses the [legacy exception handling proposal](https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/legacy/Exceptions.md) by default which allows running produced Wasm binaries in wider range of environments. +The Kotlin toolchain supports both the [legacy](https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/legacy/Exceptions.md) +and the [new](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md) +versions of the exception handling proposal. This allows Kotlin-produced Wasm binaries to run in a wider range of environments. -Since Kotlin 2.0.0, we have introduced support for the new version of Wasm [exception handling proposal](https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md) within Kotlin/Wasm. +The [`wasmJs` target](wasm-overview.md#kotlin-wasm-and-compose-multiplatform) uses the legacy exception handling proposal by default. +The new proposal is turned off for this target, but +you can enable it manually using the `-Xwasm-use-new-exception-proposal` compiler option. -This update ensures the new exception handling proposal aligns with Kotlin requirements, enabling the use of Kotlin/Wasm on virtual machines that only support the latest version of the proposal. +The [`wasmWasi` target](wasm-overview.md#kotlin-wasm-and-wasi) uses the new proposal by default, +ensuring better compatibility with modern WebAssembly runtimes. +You can manually switch to the old proposal by +using the `-Xwasm-use-new-exception-proposal=false` compiler option. -The new exception handling proposal is activated using the `-Xwasm-use-new-exception-proposal` compiler option. It is turned off by default. - -
+For the `wasmWasi` target, it is safe to adopt +the new exception handling proposal. +Applications targeting this environment usually run in a less diverse runtime environment +(often running on a single specific VM) that is typically controlled by the user, +reducing the risk of compatibility issues. > Learn more about setting up projects, using dependencies, and other tasks with our > [Kotlin/Wasm examples](https://github.com/Kotlin/kotlin-wasm-examples#readme). @@ -170,6 +179,14 @@ kotlin { Keep in mind that enabling this option increases the application size. +### Fully qualified names + +On Kotlin/Wasm targets, fully qualified names (FQNs) are available at runtime without any additional configuration. +This means that the `KClass.qualifiedName` property is enabled by default. + +Having FQNs improves code portability from JVM to Wasm targets and makes runtime errors more informative by displaying +the full qualified name. + ## Array out-of-bounds access and traps In Kotlin/Wasm, accessing an array with an index outside its bounds triggers a WebAssembly trap instead of a regular Kotlin exception. diff --git a/docs/topics/wasm/wasm-wasi.md b/docs/topics/wasm/wasm-wasi.md index e2cbe095708..288218c8fb5 100644 --- a/docs/topics/wasm/wasm-wasi.md +++ b/docs/topics/wasm/wasm-wasi.md @@ -9,7 +9,10 @@ You can find examples of an application running on [Node.js](https://nodejs.org/ and [WasmEdge](https://wasmedge.org/) virtual machines. The output is a simple application that uses the standard WASI API. Currently, Kotlin/Wasm supports WASI 0.1, also known as Preview 1. -[Support for WASI 0.2 is planned for future releases](https://youtrack.jetbrains.com/issue/KT-64568). +[Support for WASI 0.2 is planned for future releases](https://youtrack.jetbrains.com/issue/KT-64568). + +The [`wasmWasi`](wasm-overview.md#kotlin-wasm-and-wasi) target +[uses the new exception handling proposal by default](wasm-configuration.md#exception-handling-proposal), ensuring better compatibility with modern WebAssembly runtimes. > The Kotlin/Wasm toolchain provides Node.js tasks (`wasmWasiNode*`) out of the box. > Other task variants in the project, such as those utilizing Deno or WasmEdge, are included as custom tasks.