[erlang-questions] Erlang and Akka
Richard A. O'Keefe
ok@REDACTED
Thu Aug 28 07:58:33 CEST 2014
On 28/08/2014, at 3:55 PM, Xiao Jia wrote:
> But in such languages as C++/Java/... we are not forced to mutate variables so we can still employ some coding style/guidance of creating new objects instead of mutating existing objects most of the time.
>
> For example in C++
> const int x1 = 1;
> const int x2 = x1 + 1;
Books about concurrent programming in Java do strongly recommend
using immutable objects where you can.
That option is NOT available in C++.
In C++, there is no garbage collector.
Several people have put enormous effort into trying to get
the C++ standard to at least allow garbage collection, but
here we are with the third version of the C++ standard out
and it's not there yet.
Memory management is the programmer's job in C++, which
means that any realistic C++ program *has* to use mutable
variables or run out of memory in seconds.
More information about the erlang-questions
mailing list