[erlang-questions] yet another way to communicate between processes

Kostis Sagonas <>
Fri Jan 21 13:42:36 CET 2011

Matthias Lang wrote:
> How many ways can processes communicate?
>   - Message passing, obviously.
>   - ...
>   - Hipe lets you destructively update binaries

I understand the point of Matt's message, but the phrasing of the last 
item on his list is a bit exaggerated.

HiPE does NOT let you destructively update binaries!

HiPE implements (mostly for its own consumption) a byte/bit array 
interface that just happens to currently use binaries as its underlying 
representation. The term which is returned is really opaque and cannot 
be forged.

42> hipe_bifs:array(42,0).

You can not possibly pass a random binary to the appropriate BIFs and 
destructively update their contents.

43> Bin = << <<1>> || _ <- lists:seq(1,42)>>.
44> hipe_bifs:array_update(Bin, 2, 0).
** exception error: bad argument
      in function  hipe_bifs:array_update/3
         called as 

Of course, Matt is right that this mechanism could be used for 
communication: if one process does pass this array handle in a message 
to some other process, the other process can use this to read from or 
write to this array.


More information about the erlang-questions mailing list