I am proposing indeed to use WASM as the target fo...
# webassembly
s
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
How would the view side of things be handled on the Kotlin side (in a Kotlinic way) with the proposed strategy?
z
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
👌 1
s
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
Where would access to essential controls/layouts/styling etc come from (without forcing Kotliners to do things the JS way)?
s
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
So that would be accessible from Kotlin via WASM?
s
What do you mean ?
When using Kotlin React wrapper you have to write from scratch right ?
n
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
With WASM you still uses DOM etc. Currently you have to go threw JS API for that but native support is coming.
😌 1
z
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
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
But in node they will right?
Like you can't really use wasm in node
s
You can run WASM in node
z
oh ok
t
I might be wrong, but teavm do something similar. http://teavm.org/docs/flavour/templates.html and support wasm
s
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
The guy behind TeaVM (@konsoletyper) used to be very active in the Javascript channel
👌 1
s
He is a one of the Kotlin/JS developers
k
@sdeleuze he was one of the Kotlin/JS developers
s
Ok
n
@konsoletyper must have been reassigned to another area.