[erlang-questions] Process Dictionary vs Proplist in Web Frameworks

Attila Rajmund Nohl attila.r.nohl@REDACTED
Wed Oct 28 13:05:18 CET 2009

2009/10/28, Ngoc Dao <ngocdaothanh@REDACTED>:
> Hi,
> Web frameworks are normally designed as layers (web server ->
> middleware -> front controller -> controller -> action -> view ->
> etc.). Data needs to be passed from one layer to another. There are 2
> ways to pass:
> 1. Proplist (environment variables)
> 2. Process dictionary
> The 2nd way:
> * Is Simple and natural in Erlang because normally one HTTP request is
> processed by one process.

I don't have experience with web frameworks, but some erlang libraries
use a number of processes "behind the scene", and callbacks might be
executed in a quite different process context, so the process
dictinary is less then useful in these cases.

> * Makes application code which uses the framework appear to be clean,
> because application developer does not have to manually pass an ugly
> proplist arround and arround.

It's the erlang way to carry that kind of stuff around, just think
about the always-present State variable in gen_* callbacks.

More information about the erlang-questions mailing list