# A WebAssembly backend for OCaml

**URL:** <https://discuss.ocaml.org/t/a-webassembly-backend-for-ocaml/2898>\
**Category:** Community\
**Tags:** wasm\
**Created:** [November 16, 2018, 10:23am UTC](https://discuss.ocaml.org/t/a-webassembly-backend-for-ocaml/2898 "2018-11-16T10:23:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SanderSpies](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanderspies/32/7_2.png) [@SanderSpies](https://discuss.ocaml.org/u/SanderSpies)\
**Post date:** [November 16, 2018, 10:23am UTC](https://discuss.ocaml.org/t/a-webassembly-backend-for-ocaml/2898/1 "2018-11-16T10:23:50Z")

</div>

An article on the WebAssembly backend work done so far and what lies ahead:

> **[A WebAssembly backend for OCaml – Sander Spies – Medium](https://medium.com/@sanderspies/a-webassembly-backend-for-ocaml-b78e7eeea9d5)**
>
> Adding WebAssembly support to OCaml opens a lot of interesting opportunities.

---

<div class="post-metadata">

**Author:** ![struktured](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/struktured/32/385_2.png) [@struktured](https://discuss.ocaml.org/u/struktured)\
**Post date:** [November 16, 2018, 4:15pm UTC](https://discuss.ocaml.org/t/a-webassembly-backend-for-ocaml/2898/2 "2018-11-16T16:15:40Z")

</div>

@SanderSpies great article, thanks for breaking down the state of affairs. I’m trying to grasp how far away we are from a decent web assembly experience in OCaml. It sounds quite far still. In fact, the article essentially ends on the sobering point that the garbage collector extension is not mature enough yet to even begin to instrument over it. Do you think we are years away from being able to target web assembly from OCaml? Or more like months?

PS: I noticed you mentioned Tezos benefiting from your work, but so would [Holochain](https://github.com/holochain/holochain-rust), which is the driving force towards web assembly for me personally.

---

<div class="post-metadata">

**Author:** ![SanderSpies](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanderspies/32/7_2.png) [@SanderSpies](https://discuss.ocaml.org/u/SanderSpies)\
**Post date:** [November 20, 2018, 8:28am UTC](https://discuss.ocaml.org/t/a-webassembly-backend-for-ocaml/2898/3 "2018-11-20T08:28:00Z")

</div>

@struktured Apologies for the late reply, I’m doing a bit of investigation on how we can best proceed. Next year it should be possible to have an initial prototype which uses reference types and fakes the GC in JavaScript. The step from there to actual wasm GC is much smaller. I believe this is already quite exciting. I’m trying to distill these ideas in a second article.

---

<div class="post-metadata">

**Author:** ![SanderSpies](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/sanderspies/32/7_2.png) [@SanderSpies](https://discuss.ocaml.org/u/SanderSpies)\
**Post date:** [November 30, 2018, 3:25pm UTC](https://discuss.ocaml.org/t/a-webassembly-backend-for-ocaml/2898/4 "2018-11-30T15:25:52Z")

</div>

Second article is here: [https://medium.com/@sanderspies/the-road-to-webassembly-gc-for-ocaml-bd44dc7f9a9d](https://medium.com/@sanderspies/the-road-to-webassembly-gc-for-ocaml-bd44dc7f9a9d) (slightly rushed).
