[erlang-questions] Access to process dictionary

Eric Pailleau eric.pailleau@REDACTED
Mon Dec 24 00:02:16 CET 2018


Hi, 
Yes you are right. I forgot this. 
Anyway process dictionary should be avoid because same dictionary  entry name could be used in different library code called in same process. 
Let say you create an entry 'foo' in your code, but you use external code having same idea. Your dictionary can be overwritten. It is not safe. 

Envoyé depuis mon mobile 

---- Attila Rajmund Nohl a écrit ----

>Eric Pailleau <eric.pailleau@REDACTED> ezt írta (időpont: 2018. dec.
>23., V, 10:13):
>>
>> You should however avoid to use process dictionaries if possible.
>>
>> It is handy to store things, but generally a sign that your code is missing something.
>>
>>
>> For instance if you face some processes crashes, your process dictionary will be lost, while using states in OTP libs will be shown in crash report. Easier for debugging.
>
>I do see the process dictionary in crash reports (I'm not sure if
>lager puts it there or it is there by default). Process dictionary is
>useful for read-only data (i.e. not state): put stuff there at process
>startup, then don't have to worry about passing yet an other value
>around, all function can access that piece of data.
>_______________________________________________
>erlang-questions mailing list
>erlang-questions@REDACTED
>http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181224/b12721da/attachment.htm>


More information about the erlang-questions mailing list