Hacker News new | ask | show | jobs
by ThemalSpan 1239 days ago
I agree up to the last point. You can catch panics at the thread level right? I mean, more generally, what is Erlang implemented in?
6 comments

> I mean, more generally, what is Erlang implemented in?

"Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang." - Virding's Law ;)

So first you have to implement all those things. And then use them.

You can in C/C++. Though, the point is that erlang has a strategy how to clean and recover from such error (some data can be lost, rarely we can crash the whole system for some errors).

I mean, you can write erlang-way in almost any language, just in this case you need to adopt all the libraries to follow the same principles.

Some languages implement similar error handling strategy by just creating a separate process per request (hello, php). We know how to clean after a worker dies (just let the worker die). Just in that case supervisor strategy is very simple.

Of course you could implement a language like Erlang in Rust, but I think the point is that you would have to do exactly that in order to do in Rust what Erlang does at the language level.
Erlang is implemented on top of BEAM which has its own scheduler and schedules its own idea of lightweight processes.
It looks like features that the Go runtime provides.
In C. You don’t operate on thread level directly, threads are just executors of processes managed by VM, usually the same amount as vCPU cores.
>> I mean, more generally, what is Erlang implemented in?

Pure magic, that can't be recreated in any regular language :)