[erlang-questions] Add a new data structure to erlang VM.

Constantin Kulikov zxnotdead@REDACTED
Mon Jul 11 11:07:03 CEST 2016


> 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

The same rules could be applied to a doubly linked list or a 'queue' that
internally implemented as a doubly linked list.

> and D is not a data object visible to the process
> ETS tables are not data structures in an Erlang process.

Anyway, they are mutable(right?) and I didn't ask that a new data structure
must necessarily reside in an Erlang process.

> Another way to model process dictionaries would be to model a dictionary
as a sibling process
Doubly linked lists are also could be modeled as a chain of processes.
Looks like anything could be modeled in a terms of communicating
processes(actors), but it will not be efficient otherwise the erlang's
linked lists, maps, ets tables, tuples would have been made like that.


On 11 July 2016 at 08:31, <ok@REDACTED> wrote:

> >> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160711/e74407d0/attachment.htm>


More information about the erlang-questions mailing list