[erlang-questions] *current* value?

Vance Shipley <>
Wed Oct 17 21:05:06 CEST 2007


YC,

As I see it the process dictionary has one and only one
legitimate purpose and that is to store process data for
OTP tools such as the debugger.  If you are building a 
library to add tool functions to arbritray code modules
than using the process dictionary may be reasonable.

If you need a variable to persist through function calls
you would normally pass it as a function argument.  If
there are too many consider storing variable data in records
and pass the record (i.e. #state{a=1, b=2, ...}).

If there is too much process data for that approach look
to using ets.  Beyond that look to mnesia.

For a purely functional solution use a seperate process to
store the data and use message passing.

	-Vance



More information about the erlang-questions mailing list