Meyer, OO and concurrency
Ulf Wiger
ulf@REDACTED
Thu Jul 14 09:54:09 CEST 2005
Den 2005-07-14 03:24:21 skrev Vance Shipley <vances@REDACTED>:
> I used the process dictionary when I wrote my first application.
> It would be interesting to see what that looked like now but it's
> been lost to protect the ignorant. The answer to global variables
> seemed to be to use the process dictionary so that's what we did.
>
> The light came on soon afterwards and I haven't used it again. Nor
> have I used "private ets tables". At times I probably should have
> as the error reports can be unwieldy when you have too much state
> data. But this is not to say that there is no place for the process
> dictionary or ets. It's just that in most cases folks will use them
> to program imperatively.
Granted.
The part I've objected to in the past was the "process dictionary bad,
ets good" mentality, where both have similar semantics, and both
can be emulated by processes and message passing.
The underlying notion is _side effects_. They are absolutely necessary
for any interesting program, but how often we use them, and in how
many places in our code, has a dramatic effect on code quality.
BTW, as Klacke (who wrote the first ets implementation) says:
The purpose of ets was to provide efficient off-heap storage for
large data sets. Thus, one of the key features of ets is that it's
not garbage-collected.
/Uffe
More information about the erlang-questions
mailing list