[erlang-questions] Add a new data structure to erlang VM.
Mon Jul 11 07:31:24 CEST 2016
>> everything else by design is immutable
> Tell this to ets tables and process dicts.)
ETS tables are not data structures in an Erlang process.
They are outside all processes and act in some ways.
Each process has its own dictionary, and if you search
the archives, you will discover that process dictionaries
can in principle be eliminated by a source to source
transform that simply passes the current value around as
an extra parameter. The key point is that a process's
dictionary in and of itself is *not* represented as a
data structure inside the process. If a process dictionary
D contains an association K -> V, then V is not mutable,
K is not mutable, the association K->V is not a data object
visible to the process, and D is not a data object visible
to the process.
Another way to model process dictionaries would be to model
a dictionary as a sibling process, with operations on the
dictionary done by RPC calls.
More information about the erlang-questions