[erlang-questions] Erlang and asm.js

Grzegorz Junka list1@REDACTED
Fri May 20 12:26:25 CEST 2016


On 20/05/2016 00:56, Richard A. O'Keefe wrote:
>
> On 20/05/16 4:12 AM, Grzegorz Junka wrote:
>> Has anyone tried to port Erlang to asm.js so that it could run in the 
>> browser?
> Erlang can run without native code.  C can be compiled to JavaScript
> using emscripten.  The real problem, I imagine, is support for libraries.
>
> I suppose this would solve the problem of Erlang running too fast on
> too many platforms.

I didn't think running Erlang beam file on top of a virtual machine 
running on asm.js would be beneficial if both, the BEAM VM and the 
Erlang code could be compiled to asm.js. And which libraries do you 
require support for? If they are Erlang libraries and can be compiled to 
asm.js they can run alongside the main application.

The only difficulty I can see is the scheduler which would need to work 
on JavaScript workers somehow instead of real CPU cores. But if they 
managed to run Ruby, Lua, Perl, Python, OpenGL, SQLite, Unreal Engine 
3/4, Doom, and Dosbox on asm.js (among others) I don't see a technical 
reason why it wouldn't be possible somehow with Erlang, even if the 
scheduler had to use just the main underlying asm.js thread to juggle 
all its processes.

Grzegorz



More information about the erlang-questions mailing list