[erlang-questions] make_ref bug or feature?

Richard Carlsson <>
Fri Mar 27 13:21:05 CET 2009


Joe Armstrong wrote:
> If I start two erlang shells and evaluate the following in both shells:
> 
> 1> io:format("~p~n",[term_to_binary(make_ref())]).
> <<131,114,0,3,100,0,13,110,111,110,111,100,101,64,110,111,104,111,115,116,0,0,
>   0,0,34,0,0,0,0,0,0,0,0>>
> 
> They *both* print the same thing - this violates the principle of
> least astonishment.
> (I thought I'd have to start 2^82 shells :-)
> 
> Is this a bug or a feature?

You didn't start two different distributed nodes, just two VM:s in
non-distributed mode. The node name is included in the representation,
which you can see if you extract a part of the byte sequence above:

2> [110,111,110,111,100,101,64,110,111,104,111,115,116].
""

So you got the same name (and everything else the same too) in
both VM:s, i.e., the default name.

   /Richard



More information about the erlang-questions mailing list