[erlang-questions] Erlang shell, process dictionary & rand:seed

Raimo Niskanen raimo+erlang-questions@REDACTED
Thu Jan 12 13:43:52 CET 2017


On Thu, Jan 12, 2017 at 09:58:06AM +0000, Roger Lipscombe wrote:
> On 12 January 2017 at 08:41, Raimo Niskanen
> <raimo+erlang-questions@REDACTED> wrote:
> > It is a shell feature.
> >
> > Notice below - an "** exception error:" is different from
> > "*** Shell process terminated! ***".  1/0 is as well as most other
> > exceptions is caught by the evaluator so the process will not exit.
> 
> Except that the process *does* exit (note that my shell displays the
> pid in the prompt, but I've added self() calls to be clear):
> 
> Erlang/OTP 17 [erts-6.4.1.2] [source-73fc7ca] [64-bit] [smp:12:12]
> [async-threads:10] [hipe] [kernel-poll:false]
> 
> Eshell V6.4.1.2  (abort with ^G)
> <0.33.0> 1> self().
> <0.33.0>
> <0.33.0> 2> put(a, 1).
> undefined
> <0.33.0> 3> get().
> [{a,1}]
> <0.33.0> 4> 1/0.
> ** exception error: an error occurred when evaluating an arithmetic expression
>      in operator  '/'/2
>         called as 1 / 0
> <0.38.0> 5> self().
> <0.38.0>
> <0.38.0> 6> get().
> [{a,1}]

Well, how about that!?

The shell does strange things.  It is for example divided into two
processes; one evaluator process and one other process that I think for
instance owns links, receives messages, etc.

It seems the shell emulates what I said i.e that an exception was caught,
but the process receiving messages actually died due to the exception.

Confusing.  I wonder if it is possible to correct...?

Nevertheless, if a non-emulated process dies due to a runtime error e.g
division by zero, its process dictionary, links and other process stuff
dies with it.

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list