https://kotlinlang.org logo
Title
s

sdeleuze

10/18/2018, 9:08 AM
I am proposing indeed to use WASM as the target for the entire frontend and keep JavaScript as an interrop concern, not the mandatory building block than unlike Java is not seemless when used from Kotlin. Everything compiled to WASM can be exposed with a JS API if you want to consume it from JS world, see Lin Clark articles about that.
✔️ 2
1
n

napperley

10/18/2018, 9:11 AM
How would the view side of things be handled on the Kotlin side (in a Kotlinic way) with the proposed strategy?
z

zjuhasz

10/18/2018, 9:12 AM
Maybe node devs would be a concern if we couldn't target js with our libraries? Although it looks like this is also being worked on https://www.npmjs.com/package/wasm
:yes: 1
s

sdeleuze

10/18/2018, 9:13 AM
The community would develop frameworks like Angular, Vue or React but in natively writtend in Kotlin front end without relying on JS libraries underneath, these libraries would use a new Web API which would be the equivalent of https://rustwasm.github.io/2018/09/26/announcing-web-sys.html
1
n

napperley

10/18/2018, 9:13 AM
Where would access to essential controls/layouts/styling etc come from (without forcing Kotliners to do things the JS way)?
s

sdeleuze

10/18/2018, 9:14 AM
I don't think WASM will be that much interesting for JS and TS based stack, except for cryto etc.
You would still use DOM & Web APi exposed by the browser
n

napperley

10/18/2018, 9:14 AM
So that would be accessible from Kotlin via WASM?
s

sdeleuze

10/18/2018, 9:15 AM
What do you mean ?
When using Kotlin React wrapper you have to write from scratch right ?
n

napperley

10/18/2018, 9:16 AM
Haven't used React. Heavily relying on access to standard Web APIs which is used in this library ( https://gitlab.com/webscene/webscene-core/tree/master/js ) for instance.
s

sdeleuze

10/18/2018, 9:17 AM
With WASM you still uses DOM etc. Currently you have to go threw JS API for that but native support is coming.
😌 1
z

zjuhasz

10/18/2018, 9:20 AM
I'm totally sold on the Kotlin wasm frontend. I'm just not sure if it should replace the js target because it's useful for multiplatform library developers. Basically the same reason why I think a .net / clr target would be useful. So it makes it clean and easy to have one multiplatform Kotlin library that can be used by non-kotlin developers.
s

sdeleuze

10/18/2018, 9:22 AM
When targeting WASM, you can provide a JS API almost for free.
So while it is possible to keep 2 different targets JS + WASM
I think it would be more efficient to focus on WASM and provide the option to expose it with a JS API, just for the public API
JS users won't see any difference
+ there are WASM to JS converters
z

zjuhasz

10/18/2018, 9:23 AM
But in node they will right?
Like you can't really use wasm in node
s

sdeleuze

10/18/2018, 9:25 AM
You can run WASM in node
z

zjuhasz

10/18/2018, 9:25 AM
oh ok
t

Tristan Caron

10/18/2018, 9:27 AM
I might be wrong, but teavm do something similar. http://teavm.org/docs/flavour/templates.html and support wasm
s

sdeleuze

10/18/2018, 9:27 AM
Indeed, and there is inspiration to take from TeaVM as well
Kotlin/Native, TeaVM, Kotlin/JS all provide part of the unified Kotlin frontend ideal solution, just need to have something consistent that take the best of these partial solutions
2
p

pabl0rg

10/19/2018, 9:02 AM
The guy behind TeaVM (@konsoletyper) used to be very active in the Javascript channel
:yes: 1
s

sdeleuze

10/19/2018, 9:11 AM
He is a one of the Kotlin/JS developers
k

konsoletyper

10/19/2018, 9:19 AM
@sdeleuze he was one of the Kotlin/JS developers
s

sdeleuze

10/19/2018, 9:47 AM
Ok
n

napperley

10/19/2018, 9:45 PM
@konsoletyper must have been reassigned to another area.