[erlang-questions] make_ref bug or feature?
Fri Mar 27 13:18:43 CET 2009
The node name is included in the encoding of a ref so if you have 2
unnamed nodes they will be able to create
the same values with make_ref.
If you have node a and node b they will create different values with make_ref.
On Fri, Mar 27, 2009 at 12:52 PM, Kenneth Lundin
> The reference is unique within one Erlang VM.
> I don't think you started 2 shells towards the same VM.
> On Fri, Mar 27, 2009 at 12:43 PM, Joe Armstrong <> wrote:
>> I got a question from Ivo Danihelka about make_ref().
>> Isn't make_ref() supposed to generate "an almost unique reference" the
>> manual says
>> "Returns an almost unique reference.
>> The returned reference will re-occur after approximately 2^82
>> calls; therefore it is unique enough for practical purposes."
>> If I start two erlang shells and evaluate the following in both shells:
>> 1> io:format("~p~n",[term_to_binary(make_ref())]).
>> 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?
>> erlang-questions mailing list
More information about the erlang-questions