[erlang-questions] Shell pid changes after an error occurred

Richard A. O'Keefe <>
Mon Apr 10 06:48:41 CEST 2017


Reflecting on this, I know *I* was surprised the first time I
realised that exceptions crashed and restarted the shell.
One reason it was surprising was that
1> X = 1.
1
2> Y.
* 1: variable 'Y' is unbound
3> error(goo).
** exception error: goo
4> X.
1
5> Y = self().
<0.37.0>
6> error(cthu).
** exception error: cthu
7> {Y, self()}.
{<0.37.0>,<0.41.0>}

so that "ports and ETS tables as well as processes linked to
the evaluator process" don't "survive the exception" in
contrast to variable bindings, which visibly DO survive.

The case of Y is particularly confusing.

Would it help if restarted shells printed a message
"Shell restarted: associated ports, ETS tables, and links lost."
?





More information about the erlang-questions mailing list