WebAssembly and Elixir

wasm

#1

With WebAssembly just getting started do you guys think that one day we’ll be able to run Elixir in the web browser and use it to do similar tasks that Javascript does today?


Elixir + WASM -> will it happen?
#2

There’s no BEAM on any web browser … web assembly or not. So what’s the point?

Sequential programming without the concurrency goodies doesn’t make for a compelling use case.


#3

It’d be entirely possible to make a backend for the compiler (like HiPE is for exammple) that compiles to webassembly.

Do note, webassembly is NOT just for running in the browser, it is a standard that defines a base bytecode for sandboxed execution. There are webassembly runners in C, Java, even an FPGA washing machine (yes really), none of which have Javascript or any of Javascript’s calls or libraries. It is just another backend, like x86 or ARM.


#4

Whooooa!! Very good idea! Do you think it would be hard to write a new browser on top of BEAM? And of course, support to execute any BEAM code? Is there a BEAM-JS for backward-compatibility? So many ideas coming on! That would be heaven!


#5

Looks like there is a start on it called ErlyJS. But it feels abandoned. Here is a post about it and here is a fork of the original project, which is not available on Google Code anymore.


#6

Thanks for letting me know that. So once it’s fully ready you’d be able to securely isolate Elixir code from the operating system? That sounds really useful :slight_smile:


#7

Technically you could compile the BEAM VM to it now (though single-core mode), probably just need to fill in a few (many) wrapper functions as necessary for ‘OS’ interactions and/or faking. :slight_smile:


#8

I just listened to episode 323 of the Software Engineering Radio podcast today and was struck by similar thoughts. They broached the topic of concurrency issues with WebAssembly and how shared-memory (:scream:) multi-threading (which relies on SharedArrayBuffer) was incapacitated due to unforeseen security issues (SharedArrayBuffer and timing attacks, “Meltdown and Spectre”).

At that point, BEAM dinged in my head.

Either having a web browser built in top of the BEAM or having modern browsers use BEAM as a virtual machine in which to execute WebAssembly or something similar to that. In the extreme, maybe BEAM byte-code could even be a viable alternative to WebAssembly.

Perhaps having Elixir compile to WebAssembly would be interesting. As I understand it, one must use C++ or Rust for that right now (and Go is also adding support for it). WebAssembly has some issues with garbage collection (or, rather, lack thereof) which might make that difficult.


Running BEAM in the Web Browser
#9

Wow. @DockYard is thinking of investing time to explore compiling @elixirlang and the BEAM to #wasm. Very ambitious and exciting. #ElixirConf

— David Bernheisel (@bernheisel) September 6, 2018

Looks like Dockyard is considering investing in this idea.


Running BEAM in the Web Browser
#10

Is there any news on weather or not Dockyard is still working in compiling the BEAM to WASM?
(or other organizations or people working on a similar project)