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

ok <>
Sun Jul 10 13:16:29 CEST 2016


> On Sat, Jul 9, 2016 at 1:54 PM, Constantin Kulikov <>
> wrote:
>
>> If I want to add a new datastructure to erlang(my local fork of the
>> erlang-otp from github),

The example of a doubly linked list is a poor one because Erlang
data structures are supposed to be immutable and inconsequence
acyclic.  (Suppose A points to B.  Then B must have been created
before A.)  The garbage collector is entitled to rely on this.

The best you can do is to have some sort of C object kept *out* of
the Erlang per-process heaps (perhaps along the lines of large
binaries, perhaps even hidden inside large binaries) and only
provide some sort of possibly encoded *reference* to these things
to Erlang.

No, I tell a lie.  The *best* thing is to NOT add a new low-level
data structure to Erlang.  Mixing data structures between languages
with different memory management strategies is for people who like
pain too much.

Perhaps you could open up a little about what problem you are
hoping to solve by doing this.




More information about the erlang-questions mailing list