[erlang-questions] list_to_pid() surprise

Per Hedeland per@REDACTED
Sat Feb 28 16:55:41 CET 2009


Ulf Wiger <ulf.wiger@REDACTED> wrote:
>
>If creating the pid in the first place were the problem,
>I'd have expected the initial binary_to_term() on the
>data read from the file to fail, but it didn't.
>
>So binary_to_term(term_to_binary(Pid)) works, but not
>list_to_pid(pid_to_list(Pid)).
>
>The main difference that I can imagine matters here is
>that list_to_pid/1 is not meant to be used much.

The main difference is that the binary has the node name instead of the
number. I guess it isn't possible to fake up even a semi-valid pid
without the node name - for one thing, you wouldn't be able to do
term_to_binary() on it...

--Per Hedeland







More information about the erlang-questions mailing list