[erlang-questions] process dictionary, anyone?

Benjamin Tolputt bjt@REDACTED
Tue Apr 24 04:08:10 CEST 2007


In my (admittedly brief) experience - process dictionaries tend to be 
used as a method of making processes more like "objects" (in the OO 
sense of the word). The process dictionary is used to store state, with 
messages being the way one calls the objects "member functions". All 
things considered, this "could" be done using the standard functional 
methods but is probably done this way for efficiency (I, at least, 
assume process dictionaries are faster than standard Erlang implemented 
dictionaries).

I have been seriously considering using them for this purpose in my own 
code, but have not yet weighed up the pros & cons (efficiency vs "pure 
functional").

Regards,
B.J.Tolputt

Bob Ippolito wrote:
> Module scoped single assignment per-process variables doesn't sound
> like a terrible idea... but I have no idea what I'd use them for :) I
> think most uses of the process dictionary are probably not single
> assignment.
>
> -bob
>
> On 4/23/07, Robert Virding <robert.virding@REDACTED> wrote:
>   
>> Trouble is that it breaks the functional part of the language. Now that
>> is only really done in process dictionary, processes/message, ports and
>> ets. Though both ets and ports can be considered as processes/messages
>> and can be implemented as such though a bit less efficiently.
>>
>> So globals variables in the process dictionary is not really a Good
>> Thing. Using them as settable constants would be perhaps ok. How about
>> having them as variables and only be set-once?
>>
>> Robert
>>
>> James Hague wrote:
>>     
>>> I think the process dictionary is unfairly maligned.  Having
>>> per-process globals is a _good_ thing.  It can make code simpler and
>>> more maintainable in specific situations.  Now I'd just like some
>>> syntactic sugar to make them easier to use and to give the illusion of
>>> having dead simple hash table / dictionary support in Erlang :)
>>>
>>> James
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>
>>>       
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
>>     
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
>   





More information about the erlang-questions mailing list