[erlang-questions] list_to_pid() surprise
Ulf Wiger
ulf.wiger@REDACTED
Sat Feb 28 14:26:41 CET 2009
mats cronqvist wrote:
> "Ulf Wiger" <ulf.wiger@REDACTED> writes:
>
>> I'd be more inclined to believe that it was tricky if it weren't for
>> the fact that the pid object obviously already exists in this
>> case. (:
>
> judging from the eshell prompt, your node was started without
> distribution, in which case the pid object couldn't possibly refer
> to a real node. you must've gotten it from a file or the clipboard.
>
> or am i missing something?
That's true, I got it from a file. The part your (perhaps)
missing is that I had already "allocated" the pid.
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.
BR,
Ulf W
--
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com
More information about the erlang-questions
mailing list