[erlang-questions] list_to_pid() surprise
Sat Feb 28 09:22:02 CET 2009
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. (:
Well, it was only a minor inconvenience.
-- originalmedd. --
Ämne: Re: list_to_pid() surprise
Från: mats cronqvist <>
Datum: 2009.02.27 16.55
Ulf Wiger <> writes:
> I'm not sure whether to report this as a bug (perhaps there's
> a good reason for it...?)
> Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false]
> 11> pid_to_list(hd(v(6))).
> 12> list_to_pid(pid_to_list(hd(v(6)))).
> ** exception error: bad argument
> in function list_to_pid/1
> called as list_to_pid("<8288.15785.86>")
> If this is intentional, can someone explain why?
you can't do list_to_pid on an external pid (i.e. one that does not
start with a 0.)
I don't know why; perhaps the mapping from (node name) -> (first
element of pid) is tricky to do backwards?
More information about the erlang-questions