Impressions of Mozart-Oz

Vance Shipley <>
Mon Dec 16 21:16:11 CET 2002


Roger,

The process dictionary is just not necessary.  You can achieve the same
access to data by passing it around between functions in the module(s)
which implement the process.  If you are using the process dictionary
you are probably not thinking about the problem the way that Erlang
encourages you to.

ETS can be used to have data available across processes.  While this may
break the same sort of rules of style as previously discussed there are 
many real life situations where it is necessary.  One simple example from
the telecom domain is the "Call Reference Number" (CRN) in ISUP & ISDN.  
We may have hundreds of gen_fsm processes handling call state and for the
most part they operate independantly.  Each new call however must use a
globally unique CRN and they should really increment sequentially.  ETS
provides a handy way to do this with update_counter/3.

Now it can be argued that the more proper way of doing this is to have a
gen_server process which assigns these values and is accessed by sending
and receiving messages.  This process keeps the CRN value as State data 
which it passes to each function.  Personally I just use ETS, it's much
easier.


	-Vance

On Sun, Dec 15, 2002 at 10:07:01PM +0100, Roger Price wrote:
}  
}  What's wrong with the process dictionary? Is it a matter of performance,
}  or programming style, or something else?



More information about the erlang-questions mailing list