(1) In C++ you may get hard crashes, so to get reliability you need to use high-overhead OS processes. Erlang allows you to hundreds of thousands (yes, really) of processes because they are really lightweight (76 words + heap/stack). Also, copying within the same address space has much lower overhead (no system call/context switch) and serialisation is much simpler.
(2) Because of immutable data you can do have nice fault tolerance as follows. Imagine you have a request handler function that takes a state and a request. However, the request is malformed or triggers a bug in the handler. In a language that doesn't enforce immutability you have to restart the handler process because the state may be in an inconsistent form. In Erlang you would just discard the request (or send an error message) and handle the next request with the unmodified state.
(3) Pattern matching makes receiving a message very convenient.
I probably forgot a few things, but this gives you an idea.
It might be possible to achieve that isolation if you stick to strict coding practices, but the point where it's going to fail is when you import another library, written by someone else.
Because C++, Java and many other languages (including F#, Scala and others which have message passing libraries) do not have the enforced isolation of state, nor the ability to add notation to indicate that some piece of code is free of side effects (including all of it's dependencies), you're always going to have the risk of breakage when importing a library. The only way you can be sure that a library is actor-safe is to read it's source code - and if the source code is not available, then you're out of luck.
Java and C++ could have the potential to do actors correctly by adding the notation for side-effect-free code, using custom annotations/attributes on all functions which are actor-safe, and using some compiler extension or static analysis tools to prove correctness. I'm not aware of anything that does this for the mentioned languages though.
On the other hand, if you implement message passing in any purely functional programming language, your actors are automatically safe for free.
Not sure why this is so tough for people to understand. You usually don't need a whole new language to use a paradigm.
I'll say it again: the benefits of the concurrency model described in the original article can probably be achieved in peoples' existing/preferred dev env. It's easier and faster to look into that then to throw what you have under the bus for erlang.
In this case, your thinking appears to be, "I can accomplish the same thing in C++, so why use Erlang?" My point is that an assembly programmer might just as well say, "I can accomplish the same thing in assembly, so why use C++?" The answer is that it's a lot easier and more natural to write OO code in C++ than it is to use, say, assembler macros. The fact that something is possible is less interesting than how simple and well-supported it is.
Again, I'm not saying your choice is necessarily wrong. For your use case, it might have been right. The benefits of using a language with pervasive and highly developed support for the paradigm might not outweigh the benefits of using C++ for you. But that reflects more on your personal circumstances than on the benefits of Erlang in general.
What you seem to miss is that C++ also has some inherent value that cannot be replicated in Erlang. Namely: C++ is not assembly. You are already working on a higher level language. So the question is not "assembly or some higher level" but "how high a level should I go"?
Your response is essentially: "you should go to the highest level you can for concurrency, which (in your opinion) is Erlang".
The problem with that: you essentially reduce the whole problem domain to handling concurrency. Not what I call a good engineering analysis.
How about reusing HUGE EXISTING C++ libraries for his problem domain, instead of replicating them in Erlang?
How about reusing a ready team of C++ experts in his company, instead of retraining them in Erlang?
How about reusing existing tooling and infrastructure his company has for C++, instead of throwing it and using Erlang?
How about interfacing with external systems for which he has C++ drivers, but no Erlang ones?
You say: "The fact that something is possible is less interesting than how simple and well-supported it is". Maybe. But well supported is also not just a language attribute. How well supported it is within the industry, within his company, with his toolset, with the code he has etc?
I'm not trying to tell everyone to use Erlang. Getting things done is more important than the tool you use to do it, so whatever does that for you is good. But I'd be really amazed if somebody had used both Erlang and a C++ actor library and come out thinking that C++ was about as good as Erlang at its own game.
Guilty as charged.
I tried to answer both you and the other guy in the same thread that advocated Erlang-over-C++ without making the considerations you made in your last paragraph, and I guess I should have added something to distinguish your two cases.
No, they can't. This has been well explained elsewhere. You'd have to rework the language/dev environment down to at least the C level if not assembly.
>It's easier and faster to look into that then to throw what you have under the bus for erlang.
No, it is slower and harder.
People think Erlang is difficult simply because the syntax is weird. Spend a couple weeks learning it and you'll be up to speed.
I think people are scared off by the syntax and so are trying to rationalize that they don't really need erlang.
It is possible to replicate erlang elsewhere, but you'd have to replicate erlang. You can't just add a library to ruby and get it.
Totally disagree. Erlang is odd, but you have to understand what you're getting with that. Variable unification, etc., if very powerful (kind of like Haskell's pattern matching but a bit more powerful).
edit: </internet sarcasm> ducks
I don't believe it is possible to do real concurrency on the JVM, without rewriting key parts of the JVM.
Because rewriting or shimming the 10MM lines of code in the libraries one depends on outweighs this one particular benefit of erlang.
> I don't believe it is possible to do real concurrency on the JVM, without rewriting key parts of the JVM
Define "real concurrency".
Multi-threading is doable in any number of languages, but the problems inherent with it are why people move to concurrency.
Concurrency needs to be supported in the language itself.
You'd spend 20 years recreating this in C++ vs 2 weeks learning erlang.