[erlang-questions] list_to_pid() surprise

mats cronqvist masse@REDACTED
Fri Feb 27 17:56:34 CET 2009


Ulf Wiger <ulf.wiger@REDACTED> 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))).
> "<8288.15785.86>"
> 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?

  mats



More information about the erlang-questions mailing list