Webassembly as a Clojure target platform

3,149 views
Skip to first unread message

JvJ

unread,
Apr 4, 2016, 2:50:06 AM4/4/16
to Clojure
Is there any plan in the future to have clojure (or some dialect of clojure) compile to webassembly?  I can't say for sure if it is the "next big thing" for the web, but it is a very interesting concept.

I suppose that, if Java bytecode could cross-compile to Webassembly, we would essentially get this for free, but I'm not sure if that will happen.

Kevin Downey

unread,
Apr 4, 2016, 3:12:30 AM4/4/16
to clo...@googlegroups.com
I recommend reading up on WebAssembly, a good place to start might be
https://github.com/WebAssembly/design/blob/master/FAQ.md#is-webassembly-only-for-cc-programmers/

In those three paragraphs, it is pretty clear that, at least as it
stands now, wasm is much closer semantically to actual asm than the jvm.
A whole host of facilities that you get both by running on the jvm, and
by compiling to javascript (garbage collection, types, etc) are not
available. No existing Clojure, ClojureScript, or some derivative there
of delivers those things themselves, they all build on some existing
runtime's facilities.

Some additional relevant reading is here:
https://github.com/WebAssembly/design/blob/master/GC.md
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+u...@googlegroups.com
> <mailto:clojure+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

Hlöðver Sigurðsson

unread,
Sep 13, 2017, 5:03:25 PM9/13/17
to Clojure
https://github.com/AssemblyScript/assemblyscript


Looks like the Typescript people are attempting exactly this.

Nur Azhar

unread,
Sep 15, 2017, 3:08:18 AM9/15/17
to Clojure
Correct me if I am wrong, webassembly is just a compiler currently only supports C,C++ and rust and we might be able to compile clojure to webassembly in the far future?

Bo Yao

unread,
Jul 26, 2018, 11:34:59 AM7/26/18
to Clojure
Not true.Wasm is a a kind of assembly and it's browser runtime: https://webassembly.github.io/spec/. The emscripten project is doing compile c/c++ to wasm. There's a another team working on rust to wasm compiler and toolchains: https://webassembly.github.io/spec/

Nathan Fisher

unread,
Jul 26, 2018, 3:16:48 PM7/26/18
to clo...@googlegroups.com
Think Rust and Golang both have the ability to target WASM now too. I'm not sure how well Java Byte-Code to WASM would work in practise. Found this project that seems able to transpile from Java ByteCode to JS/WASM;

http://teavm.org/

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
- sent from my mobile

Gerard Klijs

unread,
Jul 26, 2018, 7:32:48 PM7/26/18
to Clojure
Kotlin native can also target wasm. But I don't know enough of it to know if it's usefull for the clojure story. Since there is very little you can do with wasm, it's highly dependent on interacting with JavaScript. It's possible some computational heavy stuff might better be done in wasm then JavaScript. But as wasm doesn't have baked in garbage collection, and for closure(script) we depend on the host for garbage collection, it will probably be a lot of work to pull this off.

scst...@gmail.com

unread,
Jul 31, 2018, 1:46:47 PM7/31/18
to Clojure
Seems this would be a good feature to follow then: Garbage Collection

Nathan Fisher

unread,
Jul 31, 2018, 2:07:19 PM7/31/18
to clo...@googlegroups.com
I haven’t been following it that closely. I thought GC is planned but not targeted for MVP or has that changed?

On Thu, Jul 26, 2018 at 20:32, Gerard Klijs <g.k...@gmail.com> wrote:
Kotlin native can also target wasm. But I don't know enough of it to know if it's usefull for the clojure story. Since there is very little you can do with wasm, it's highly dependent on interacting with JavaScript. It's possible some computational heavy stuff might better be done in wasm then JavaScript. But as wasm doesn't have baked in garbage collection, and for closure(script) we depend on the host for garbage collection, it will probably be a lot of work to pull this off.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages