Question on "The Erlang Way"

Alex Peake <>
Sun May 19 23:19:09 CEST 2002

Thank you for your suggestion.

I think I will use "ets" as my first attempt.


-----Original Message-----
[mailto:]On Behalf Of Hakan Stenholm
Sent: Saturday, May 18, 2002 3:40 PM
Subject: Re: Question on "The Erlang Way"

>> I am new to Erlang. Can someone help me to "think the Erlang way"
>> on the following (I am from the Lisp world):
>> 1) I want to create a "global" to the application dict. Is this
>> best
>> done by spawning a process that manages the dict (like the number
>> analyser sample in the Book)? It seems that because of the
>> "assign once"
>> strategy, regular variables do not work (dict:store returns a new
>> Dict).

>Regular variables are also local to a single process. But process
>names aren't, so a named process (like the number analyser example)
>is probably the way to go.

You can either use "gen_server" to create a custom server process or if you
only need a key-value database you could also use "ets", ets tables can be
created as either local or global - global ones can be accessed by any other

There is also the "put" and "get" operations (see the erlang module) to use
the process dictionary, this allows global variables in the scoop of a
single process.
Process dictionaries should for obvious reasons (obfuscating code execution
flow) only be used sparingly.

Mnesia can be used as a alternative to ets if proper database transaction
support is needed.

More information about the erlang-questions mailing list