1 of 138

Kotlin/Wasm:

Present and Future

Zalim Bashorov

@bashorov

2 of 138

Zalim Bashorov

@bashorov

Kotlin/Wasm:

Present and Future

3 of 138

PRESENT and future

Zalim Bashorov

@bashorov

Kotlin/Wasm:

4 of 138

Agenda

5 of 138

Agenda

WebAssembly

6 of 138

Agenda

WebAssembly

Kotlin/Wasm

7 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

8 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

9 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

10 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

11 of 138

WebAssembly (aka Wasm)

| … is a binary instruction format for a stack-based virtual machine.

12 of 138

WebAssembly (aka Wasm)

Key Advantages

13 of 138

WebAssembly (aka Wasm)

Key Advantages

Portability

14 of 138

WebAssembly (aka Wasm)

Key Advantages

Security

Portability

15 of 138

WebAssembly (aka Wasm)

Key Advantages

Security

Performance

Portability

16 of 138

WebAssembly (aka Wasm)

Key Advantages

Security

Performance

Lightweight

Binaries

Runtimes

Portability

17 of 138

WebAssembly (aka Wasm)

Key Advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

18 of 138

WebAssembly (aka Wasm)

Everywhere

19 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

20 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

21 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

22 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

23 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

24 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

25 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

26 of 138

WebAssembly (aka Wasm)

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

27 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

28 of 138

29 of 138

+

30 of 138

+

=

31 of 138

New Compiler

32 of 138

New Compiler

Fast Compilation

Incremental Compilation*

33 of 138

New Compiler

Fast Compilation

Incremental Compilation*

Great integration with hosts

34 of 138

New Compiler

Fast Compilation

Incremental Compilation*

Great integration with hosts

Good Interop with hosts

import kotlinx.browser.document

fun main() {

val p = document.createElement("p")

p.innerHTML = "Hello World!"

document.body?.appendChild(p)

}

35 of 138

New Compiler

Fast Compilation

Incremental Compilation*

Great integration with hosts

Good Interop with hosts

import kotlinx.browser.document

fun main() {

val p = document.createElement("p")

p.innerHTML = "Hello World!"

document.body?.appendChild(p)

}

Small binaries

36 of 138

New Compiler

4K

Fast Compilation

Incremental Compilation*

Great integration with hosts

Good Interop with hosts

import kotlinx.browser.document

fun main() {

val p = document.createElement("p")

p.innerHTML = "Hello World!"

document.body?.appendChild(p)

}

Small binaries

37 of 138

Targets

38 of 138

Targets

wasm-js

39 of 138

Targets

wasm-js

wasm-wasi

40 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

41 of 138

Runtime Requirements

Wasm VMs must support next proposals:

42 of 138

Runtime Requirements

Wasm VMs must support next proposals:

Garbage Collection (GC)

43 of 138

Runtime Requirements

Wasm VMs must support next proposals:

Garbage Collection (GC)

Exception Handling*

44 of 138

Inside Browsers

Works out of the box in major browsers

45 of 138

Inside Browsers

Works out of the box in major browsers

V

46 of 138

Inside Browsers

Works out of the box in major browsers

V

V

47 of 138

Inside Browsers

Works out of the box in major browsers

V

V

48 of 138

Inside Browsers

Works out of the box in major browsers

V

V

V*

49 of 138

Inside Browsers

Works out of the box in major browsers

V

V

V*

50 of 138

Inside Browsers

Works out of the box in major browsers

V

V

V*

soon

51 of 138

Outside of Browsers

52 of 138

Outside of Browsers

V

V

V

V

V

Node.js

Deno

Workerd (Cloudflare Workers)

WasmEdge (0.14+)

WAMR 2.0+

53 of 138

Outside of Browsers

V

V

V

V

V

Node.js

Deno

Workerd (Cloudflare Workers)

WasmEdge (0.14+)

WAMR 2.0+

Wasmtime

Wasmer

54 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

55 of 138

Use Cases

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

56 of 138

Use Cases

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

57 of 138

Use Cases

Everywhere

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

58 of 138

Use Cases

Everywhere

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

Web Applications

59 of 138

Compose Multiplatform

60 of 138

Compose Multiplatform

61 of 138

Why Kotlin/Wasm?

62 of 138

Compose for Web is Alpha

Alpha

63 of 138

Why Web?

64 of 138

Why Web? Web is a Good Platform

65 of 138

Why Web? Web is a Good Platform

Open platform

66 of 138

Why Web? Web is a Good Platform

Open platform

Browsers are everywhere

Mostly up-to-date

67 of 138

Why Web? Web is a Good Platform

Open platform

Browsers are everywhere

Mostly up-to-date

App Distribution

Easy

Under your control

Always up-to-date

68 of 138

Why Web? Web is a Good Platform

Open platform

Browsers are everywhere

Mostly up-to-date

App Distribution

Easy

Under your control

Always up-to-date

App Running

Easy

No need to install

You can install, if you want

69 of 138

Why Web? Web is a Good Platform

Open platform

Browsers are everywhere

Mostly up-to-date

App Distribution

Easy

Under your control

Always up-to-date

App Running

Easy

No need to install

You can install, if you want

Near-Native performance with WebAssembly

70 of 138

71 of 138

72 of 138

73 of 138

74 of 138

Offline mode

75 of 138

76 of 138

Standalone App

77 of 138

78 of 138

79 of 138

80 of 138

81 of 138

82 of 138

83 of 138

1

84 of 138

2

85 of 138

86 of 138

Diff

87 of 138

Diff

88 of 138

Diff

89 of 138

Try it!

90 of 138

Adding Web to Compose App

Examples

91 of 138

Adding Web to Compose App

Examples

92 of 138

Adding Web to Compose App

Examples

93 of 138

It’s you turn…

94 of 138

95 of 138

Outside of Browsers

Cloud & Edge computing and more …

96 of 138

Why?

Outside of Browsers

Cloud & Edge computing and more …

97 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

98 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

99 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

100 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

101 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

102 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

103 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

104 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

105 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

106 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

107 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

108 of 138

Key advantages

Security

Performance

Lightweight

Binaries

Interoperability

Runtimes

Portability

Web Applications

Cloud & Edge computing

Plugins & Extensions

Embedded

Blockchain

Mobile

Desktop

109 of 138

WASI

WebAssembly System Interface

group of standard API specifications for Wasm

110 of 138

WASI target

111 of 138

WASI target

Based on WASI Preview 1 (K 1.9.20+)

V

112 of 138

WASI target

Based on WASI Preview 1 (K 1.9.20+)

V

WASI 0.2 (aka Preview 2)

Component Model

113 of 138

WASI: DEMO time!

114 of 138

115 of 138

inside Cloudflare Workers

116 of 138

117 of 138

Agenda

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

118 of 138

Tooling

119 of 138

Tooling

IDEs

120 of 138

Tooling

IDEs

Debugger

121 of 138

Tooling

IDEs

Debugger

Build Tools

122 of 138

Tooling in Action

123 of 138

124 of 138

Explore

125 of 138

126 of 138

Edit

127 of 138

128 of 138

Debug

129 of 138

130 of 138

Takeaways

WebAssembly

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

131 of 138

Takeaways

Kotlin/Wasm

State of Wasm Runtimes

Use cases

State of Tooling

WebAssembly is Cool!

132 of 138

Takeaways

State of Wasm Runtimes

Use cases

State of Tooling

WebAssembly is Cool!

Kotlin is Awesome!

133 of 138

Takeaways

Use cases

State of Tooling

WebAssembly is Cool!

Kotlin is Awesome!

Compose for Web is Future of Web Apps!

134 of 138

Takeaways

State of Tooling

WebAssembly is Cool!

Kotlin is Awesome!

Compose for Web is Future of Web Apps!

Outside of Browser usage is Promising!

135 of 138

Takeaways

WebAssembly is Cool!

Kotlin is Awesome!

Compose for Web is Future of Web Apps!

Outside of Browser usage is Promising!

Tooling is Good!

136 of 138

137 of 138

138 of 138

Thank you, and

don’t forget to vote

@bashorov