This article was first published on æternity blog - Medium

Transpiling Erlang to Javascript. Yes, you read it right.

It is safe to say that Erlang as a language and framework is the most reliable choice out there to build highly stable applications, running the likes of Whatsapp and Discord. Now, there is a transpiler introducing concepts of Erlang to web technology, which would be near impossible to implement manually using Javascript.

Here at æternity, we’ve envisioned for a long time that running major parts of a blockchain protocol in the context of modern web frameworks would mean a huge leap for the adoption and scalability of distributed ledger technology. What if you could run an ad-hoc blockchain node in your browser, or use state channels to quickly make safe payments using your phone?

As a solid foundation had to be laid for a reliable infrastructure first, that was not conceivable as of yet. Until now.

Erlscripten is here.

Erlscripten (sic not Emscripten!) is a source-to-source transpiler capable of converting most Erlang codebases into semantically equivalent Purescript projects. Purescript is a strongly typed language heavily inspired by Haskell and which compiles down to Javascript. Taking Purescript as an intermediary step, Erlscripten allows you to take your existing Erlang application and easily ship it out to Javascript users — your Erlang code can now run safely in the browser — enabling code sharing between an Erlang backend and the frontend. It is highly interoperable with Javascript — Javascript can easily call the transpiled code and then make use of the results — you can easily map Erlang constructs and types to readily available JS constructs.

It’s zero hassle — you point Erlscripten to an existing Rebar3 Erlang project and in result get a compatible spago project ready to be used in existing Purescript/Javascript projects. While at it, we transpiled the Erlang runtime (ERTS) that allows you to run arbitrary transpiled Erlang code:

To keep reading, please go to the original article at:
æternity blog - Medium

Comments (No)

Leave a Reply