Live data from Hacker News

WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

developer.chrome.com

61–70 of 88 posts

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#61
post #25

Finally, Java arrives to our browsers! Maybe we could use it to write some small applications with it, let's call them "applets".

I'm kind of excited to see the "WASM JVM" capable of running oldschool java applets (Much like Ruffle for flash).

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#62

Interesting - they essentially ship a GC inside the Wasm runtime that replaces what the language VM - be it the JVM, the .NET CLR, Go's GC would supply. But that raises the question - wouldn't it imply that this GC needs to support every special feature of every language (interior pointers, pinning, value types etc.), and have access to the stack layout to have a chance of working? Sounds like a hairy problem to me.…

> interior pointers, pinning, value types etc.

WASM still grants access to a PL to simply decide to allocate a byte and manage it itself. interior pointers and value types seem like they could be handled by reference counting + native memory allocation. Much like Python is trying to do to introduce tracing GC. Use RC when you can't use the tracing GC.

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#63
post #25

Finally, Java arrives to our browsers! Maybe we could use it to write some small applications with it, let's call them "applets".

Ok, but we need a way to interface with it - using a scripting language for instance.

Let's call this language Java Script so that it's clear what its narrowly defined intended purpose is.

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#64
post #25

Finally, Java arrives to our browsers! Maybe we could use it to write some small applications with it, let's call them "applets".

I don't know, this time around there has been much more focus on security which was really what spelled doom for Flash/Java. That and it's actually included as part of web standards instead of being something that users have to download and update separately. I doubt that GC would have been added at all except that it's a requirement to speedup and simplify the boundary between the browser and WASM.

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#65

Maybe I'm old but, we already had this... it was called the tag and it let you embed Java applets. We also had Java Web Start. I feel like this solution in superior to both those things but it still feels like a step backwards.

Not sure it's superior. The object tag let you extend the browser with genuinely new capabilities, like access to hardware or APIs that JavaScript didn't expose. WASM doesn't do this.

Also, object tag let languages compete on the quality of their runtime. This also doesn't allow that. You can't ever do better than V8, and V8 isn't going to care about features unique to your language.

The main win is that the browser will keep the WASM interpreter/JIT up to date for you, and it will drop OS privs for you, and it will download and cache the bytecode for you.

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#66

Exciting to see - this along with tail call support is opening the door to Scheme in the browser too: https://spritely.institute/news/scheme-wireworld-in-browser....

We're still missing a few things like continuations. However, full tail call support speeds that up a lot since then you don't need a trampoline function. I know there was a proposal for WASM continuations, but I think that got dropped due to complexity (I don't blame them, continuations are really tricky to optimize since they are such a powerful control flow tool).

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#69
post #16

OCaml has not one but two WASM/WasmGC targeting efforts in development: https://discuss.ocaml.org/t/announcing-the-ocaml-wasm-organi... https://discuss.ocaml.org/t/an-update-from-the-ocaml-wasm-or...

Seems like a bad thing? Why are there two separate workstreams?

They are targeting two different intermediate representations in the compiler. wasm_of_ocaml is a fork of js_of_ocaml that consumes OCaml bytecode and emits Wasm instead of JavaScript. Compared to wasocaml that uses the FLambda-based backend for OCaml’s native code compiler.

Time will tell if both survive, they are both under active development. IMHO target different use cases.

Re: WasmGC – Run GC languages such as Kotlin, Java in Chrome browser

#70
post #21

Earlier quoted context omitted.

Seems like a bad thing? Why are there two separate workstreams?

Maybe adapting the existing js_of_ocaml project is comparatively easier so they might as well try it.

There is a pretty complete wasm_of_ocaml port to the Eliom web framework here https://github.com/ocsigen/eliom/pull/767

It seems like it’s a relatively easy swap from js_of_ocaml to WASM. That’s the option I’ve chosen for my experiments.

Post reply on HN