[erlang-questions] process dictionary, anyone?
Mon Apr 30 00:53:04 CEST 2007
You can represent any non-functional construct with message passing. A
side-effect is a side-effect... Erlang is clearly a hybrid language,
but it has a very useful subset that is purely functional. Much of
what I've read in the standard library is written in that purely
functional subset, and the syntax and features of the language/VM seem
like they're designed to encourage and support mostly that subset.
Using the process dictionary is a great little hack that saves you
from refactoring a bunch of code to include an extra state variable...
On 4/29/07, Robert Virding <robert.virding@REDACTED> wrote:
> Strange viewpoint!
> Ets and ports easily map onto processes/messages so except for the
> process dictionary there is really only one non-functional feature today
> and that is just processes/messages. And the process dictionary. So
> who's pretending? And why purposefully try to defeat the benefits that a
> functional language has? We might as well then just add erlang like
> processes to Java and be done with.
> That being said I have actually found a place where the process
> dictionary is useful and has no direct replacement. That is in yecc! As
> it is today there is no state which is passed around with the RHSs of
> the rules so it difficult to do much except just build a parse tree. If
> instead you want to do something there it is difficult without the
> process dictionary to pass around a state.
> Of course you always have the option of first building the parse tree
> and then traversing again to do what has to be done. But that seems so
> *negative*. :-) Fix a new version of yecc which passes a state around.
> Leex has the smae problem.
> Mats Cronqvist wrote:
> > Robert Virding 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.
> > so erlang is functional, except for the process dictionary, messages, ports
> > and ets? then perhaps it's time to stop pretending it's functional?
> > mats
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> erlang-questions mailing list
More information about the erlang-questions