catch link(Pid) when trapping exits

Raimo Niskanen raimo@REDACTED
Thu Oct 27 11:53:51 CEST 2005


francesco@REDACTED (Francesco Cesarini Erlang Training & Consulting) writes:

Yes it would.

Even better would be to never do error(noproc) but always
let a failing link send the exit signal even if the process
does not exist at the time of the call to link(Pid).

As always - it can not be changed now due to the
Backwards Compatibility Ghost.

> > It is all there, really. Only it was written before exceptions
> > were invented as a concept in Erlang, uses the term
> > "exit signal" in a confusing way and lies about "does not fail".
> > Ok, it is maybe dead wrong, but the intention was right.
> > So, what happens is:
> > link(Pid) -> true           if Pid exists or the caller has
> >                             process_flag(trap_exit, true).
> >              error(noproc)  otherwise
> > The enclosing catch evaluates to {'EXIT',{noproc,Stackdump}}
> > for error(noproc).             Weird behaviour, in my opinion..
> 
> Exactly my point. Would it not be better to return error(noproc) even
> if trapping exits instead of exit(Pid, Reason)?
> 
> Francesco
> --
> http://www.erlang-consulting.com
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list