Name
no_process_dict_usage
Brief Description
Use of Erlang’s process dictionary should be avoided.
Problematic code
put(Key, Value)
...
get(Key)
Correct code
Here is an alternative that uses the process state, too, but in a more explicit manner.
gen_server:cast(self(), {update_pd, {Key, Value}})
Rationale
Updating the process dictionary isn't, by itself, a bad practice, but it should nonetheless be used with care. This rule will warn you to make a decision on whether your implementation could be reworked or not.
Some problems occurring from using the process dictionary:
- Hidden State
- Hard to Test
- Poor Traceability
- Breaks Functional Paradigm
- Concurrency Hazards
- ...
Name
no_process_dict_usageBrief Description
Use of Erlang’s process dictionary should be avoided.
Problematic code
Correct code
Here is an alternative that uses the process state, too, but in a more explicit manner.
Rationale
Updating the process dictionary isn't, by itself, a bad practice, but it should nonetheless be used with care. This rule will warn you to make a decision on whether your implementation could be reworked or not.
Some problems occurring from using the process dictionary: