Taking half of that equation, and supporting any language, feels like you’re missing a big part of the benefit.
Taking half of that equation, and supporting any language, feels like you’re missing a big part of the benefit.
Having written concurrent code in Erlang, C# and Python, I'd view above as a win. A big win. Concurrency decisions in Erlang are simple: if things need to run concurrently, spawn them in different processes. If they're sequential, put them in a function. That's it.
In C# and Python it's nowhere near as straightforward. Do you use OS processes? Threads? Async/Await? Each has different strengths; each also has significant weaknesses.
So: a new runtime that aims to bring Erlang's simple, powerful and scalable concurrency model to any language that targets WebAssembly is, at the very least, interesting. It doesn't need to have all the wider benefits of OTP, or the symbiosis of Erlang and the BEAM. (Though that's great too obviously).
https://github.com/llaisdy/beam_languages
LFE is Virding's himself, and has been around for longer than Erlang has been popular: Robert Virding - LFE - a lisp flavour on the Erlang VM (Lambda Days 2016)
https://www.youtube.com/watch?v=Br2KY12LB2w
Edit: Implementing Languages on the BEAM - Robert Virding - London Erlang User Group
let's look at garbage collection.
How does tradition stop the world, Mark-and-sweep garbage collection work on the BEAM? it doesn't really.
Each process on the beam has its own garbage collection algo, because processes can't share memory, garbage collection on one process can happen without disrupting any other process.
Uhm, several ways:
1. Bind the VM in as a C FFI artefact
2. Write your ruby or Java bytecode emulator to run on one Erlang process only. Since Java supports threads, each thread could live on a different process, any shared memory would live on an Ets table.
"never" is a strong word. The reason why people don't do it is that it's not worth it.
I believe riak embeds javascript in the erlang VM. You can imagine why that might be worth it.
I *could* eat soup with a paper airplane, I'm really not understanding how any of this is viable solution to implementing something like ruby on the BEAM VM. What would the performance hit be for using ETS for all your state? You'd just be better off using MRI for Ruby.
The impact of bugs is minimized by compartmentalization. This is done from the lowest level where each data structure is separate and immutable [1]
But you can simulate mutability with stateful processes.
Directly from Joe Armstrong: https://joearms.github.io/published/2013-11-21-My-favorite-e...
[1] https://github.com/happi/theBeamBook/blob/3971e8e2d09e367670...
I just get skeptical when people try to retrofit an existing language/platform to act like FP in general, or Erlang in particular.
WASM is the opposite of opinionated. It was designed to be a compilation target for everything. Almost every language is working on supporting WASM, and that's exactly what WASM was intended for. Because Lunatic is built around WASM, it does support any language, because that's what WASM set out to do.