[erlang-questions] Question about message passing paradigm
Tue Jul 1 09:37:20 CEST 2008
Thank you for a very interesting and informative analysis. I must admit that
I tend to lump together Erlang/OTP as "Erlang" and see solutions in that
context. In a way, I feel as if using Erlang "standalone" without OTP is
very roughly analogous to using C++ without the STL: it can be done, but why
on earth would one want to?
I agree that the last answer didn't answer much. What I was trying to say is
that the architecture should perhaps be redesigned to fit a Functional
Programming/Message Passing paradigm and infrastructure, but I couldn't
suggest precisely how because there was almost no information about the
original architecture. So in retrospect I wound up saying nothing useful.
As a final note, let me say that I was thrown in to the deep end in Erlang
by having to learn Erlang and OTP concurrently (pun intended) because I had
to create a production system in a short period of time. This is why it's a
bit hard for me to separate the two.
Thanks again for clearly identifying the core issues, as you usually seem to
<off-topic>One last thing: I read the Ethics of Belief after poring over one
of your posts recently, and was exceptionally impressed with the gentleman's
writing and philosophy, with which I strongly agree. In that regard, I'd
like to misquote John Stuart Mill, namely, "A foolish *certainty* is the
hobgoblin of little minds". (Actually, I think my version is a slight
improvement ;) I am unfortunately seeing the mechanism of insufficiently
examined beliefs at work today, resulting in the persecution of a friend of
mine by way of (the almost totally belief-based) Shaken Baby Syndrome. So
the essay really resonated deeply with me. I daresay William K. Clifford
would have had a lot to say about this. I wish he were still alive to do so.
Bertrand Russel too.</offtopic>
On Tue, Jul 1, 2008 at 12:48 AM, Richard A. O'Keefe <>
> On 1 Jul 2008, at 3:42 pm, Edwin Fine wrote:
>> I'm new to Erlang and FP, and I want to learn from my mistakes or
>> misunderstandings. Please could you critique the suggestion I sent in
>> regarding this problem? The fact that nobody commented means either that it
>> was (a) totally naive and not worthy of comment (or to spare my feelings),
>> or (b) such a good idea that all were rendered speechless with admiration.
>> Somehow the probability of (b) seems rather low. So... where did I go wrong?
> Let's recapitulate. If I've found the right message,
> Edwin Fine had three suggestions:
> • Create a gen_fsm that controls all the collections.
> The collections could be ETS tables or gen_servers wrapping ETS
> Under normal use, messages are sent to the fsm to update the
> individually. When the time comes to require consistency across
> collections, send a message to the fsm to get the collective state
> The fsm goes into a different state while it gathers the data.
> This state would reject requests to update the collections (or
> wait until
> the state changes), although reads would still be allowed.
> On getting the result, the state changes back to allow updates
> • Create a memory-only Mnesia table for each collection, and use
> transactions to get the multiple values atomically.
> • Change the architecture of the current lock-oriented program to
> better use of Erlang's features.
> From bottom to top:
> - The last one doesn't really answer the orignal poster's question.
> At least, imagining myself in the OP's shoes, I would not find that
> answer informative. Change it HOW? WHICH features? In what way better?
> - The second one might well be the right thing to do in a production
> system. However, someone who is still struggling with how to use
> probably doesn't want to be told to learn another huge great thing, and
> might well get the impression that message passing wasn't much good
> after all.
> - As for the first one, it seemed to me that in order to do that, you'd
> pretty much have to solve the original problem anyway, plus you would
> have to come to grips with behaviours, callbacks, gen_fsm, and a lot of
> stuff which is practically very very useful, but not something to be
> understood in five minutes.
> I suppose I can summarise it as "You gave OTP answers to what I saw as
> an Erlang question". I may well be completely mistaken about where the
> OP was coming from, but I understood the question to be specifically a
> question "how can the OP solve this problem directly using message
> OTP answers are very often precisely the right answers, so don't stop
> giving them.
The great enemy of the truth is very often not the lie -- deliberate,
contrived and dishonest, but the myth, persistent, persuasive, and
unrealistic. Belief in myths allows the comfort of opinion without the
discomfort of thought.
John F. Kennedy 35th president of US 1961-1963 (1917 - 1963)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions