Erlang is special for other reasons.
Erlang is special for other reasons.
Some things that would make it more like Erlang than Go (but that I won't bother to verify):
1. Go isn't really pre-emptive, it just has a lot of hidden yield points afaik
2. Go doesn't enforce message passing, Erlang obviously does
3. When you send a message to a goroutine that has panicked you hang and, potentially at some point, panic. In Erlang an actor dying can send out a final exit message that other actors (likely a supervisor) can subscribe to.
So yeah IDK. To me if it's got lightweight processes, pre-emption, and message passing, it's got everything that makes Erlang special. If it says it's inspired by Erlang I'm going to assume that, along with those things, it also shares goals like fault tolerance.
Actors do not an Erlang make. What makes an Erlang:
- Isolation. A crash in an actor cannot bring down other actors. Cannot bring down the runtime
In Go `panic` crashes the program. In Erlang "panic" crashes an actor, and... that's it.
- Monitoring. The above makes an important property of the system: a process can be monitored, and when it dies you can be guaranteed to receive a message that it died, and why
This lets you build things like supervision trees that are impossible/hard/ineffecient(chose two) in other languages.
- Everything in the VM is aware of processes, concurrency and parallelism
Every process gets its fair share of time: each process gets X "reductions". A reduction is a function call, or a message pass. Each function call or message pass reduces the counter. Once it reaches zero, the process is put on hold, and the next process is run.
This means that almost everything in the system, including the VM itself is re-entrant. Even Erlang's regexp implementation is re-entrant. You never even have to think about "wait, if I call this function, and the process is put on hold, what happens". The process will be re-awakened and continued.
----
The first two are what makes Erlang special. The rest is gravy, and there is quite a lot of it on top.
Erlang doesn't enforce message passing. You can use ets tables to coordinate processes (but don't).
A lot of pls claim erlang inspiration, e.g. pony, but miss some very important points and focus on "actors". Erlang isn't even really an actor system at heart, it just looks like it superficially. Actor systems at their core are message and coordination focused; when you write an erlang or elixir program you are typically minimizing the message passing because it is imperformant and hard to reason about. The raison d'etre of erlang processes is not really message passing concurrency, it's failure domain definition and failure domain bundling (if x crashes also crash y, because now the state of y can't be trusted).
At some level this is true of all systems - you can't yield in the middle of a `mov`, for example. But as Erlang is interpreted it doesn't rely on yield points. The caveat is that it does if you use CFFI.
> You can use ets tables to coordinate processes (but don't).
Yeah I'm sure there are endless ways to bypass the intended use of Erlang, I don't think it's really important. This is way different from Go where data is trivially shared across a channel.
> The raison d'etre of erlang processes is not really message passing concurrency, it's failure domain definition and failure domain bundling
Yes, this is true. The foundation of Erlang is based on earlier research that Armstrong cites in his thesis paper, such as the persistent process and transaction as the basis of system resiliency. But it's not a coincidence he landed on actors to express those things.
> The caveat is that it does if you use CFFI.
No shit, I wrote a huge FFI library for the BEAM (that even implements a yielding system.that interops with erlang's yields), that's a huge part of my point about the beam not really being preemptive.
> But it's not a coincidence he landed on actors to express those things.
Yes, that's my point. In erlang the conceptual arrow goes (resiliency => not-really-but-kinda-like-actors). In these other systems, or at least the ones I've peeked at, like pony and bastion the logic goes (actors => underpants gnomes => something like erlang). It's completely backwards.
This is basically what I'm saying... at some point nothing is preemptive ie: at the instruction level.
> that's a huge part of my point about the beam not really being preemptive.
OK but I think that's really semantics, it doesn't really matter though. You are right that BEAM can't yield within an instruction or during FFI. If you think that means it isn't preemptive, ok, but as I said I think at some point you end up with "nothing is preemptive" and then "why do we have the word preemptive" and then "because it's useful to describe systems like BEAM".
> Yes, that's my point. In erlang the conceptual arrow goes (resiliency => not-really-but-kinda-like-actors). In these other systems, or at least the ones I've peeked at, like pony and bastion the logic goes (actors => underpants gnomes => something like erlang). It's completely backwards.
Sure, actors aren't "the point". They just satisfy important properties that are necessary for resiliency. Pony takes a very very different approach from Erlang. Bastion seems closer.
I don't think "distance from Erlang" is really important or interesting though. Inspiration from Erlang is present in many of these systems, whether they re-implement the exact concepts or not.