Meyer, OO and concurrency
Richard A. O'Keefe
ok@REDACTED
Thu Jul 14 00:47:11 CEST 2005
Peter-Henry Mander <pete@REDACTED> wrote:
Why are we so stuck in the muddy quagmire of reinventing workarounds to
avoid explicit concurrency in our software? My question is more about
psychology than about technology. And it applies equally to functional
programming as it does to concurrency.
Is it down to education?
I suspect that it is primarily due to one thing:
assignment statements.
Assignment statements have an AMAZING grip on programmers' minds.
To my atonishment, horror, and disgust, there is even a serious
attempt to get assignment statements into the next version of the
Prolog standard.
You may not believe that, so I shall repeat it:
there is a serious attempt to get ASSIGNMENT STATEMENTS into the
next version of the Prolog standard,
on the alleged grounds that assignments are absolutely necessary
for efficiency and that all existing systems support them anyway.
(Worse still, the proposal has two different kinds of assignment
statements, or is it three.)
And that proposal is being seriously advanced at a time when lots of
Prolog systems now support constraint handling, which means that bits
of code may run in orders and at times which are, to even a really
good programmer, quite unpredictable.
Prolog needs assignment statements like birds need rails.
Even Erlang has the shameful process dictionary, but at least process
dictionaries are private and cannot be modified by any other process.
I believe that there is a vicious circle operating between education
and assignment statements. I've been reading about parallel programming
for years. Apart from Erlang, the only language I've ever really felt
comfortable writing anything concurrent in is Ada95, because you DON'T
explicitly manipulate locks in Ada, that's the compiler's job. And the
one place I know of that taught Ada junked it in favour of Java because
Java had standardised graphics.
I note that Dijkstra had a series of papers on the topic "Building
elephants out of mosquitoes humming in harmony", not entirely unlike
systolic systems. Oddly enough, the notation Dijkstra invented for
"A Discipline of Programming" is a functional language in imperative
guise: each block must list ALL its inputs and ALL its outputs and
there is no sharing between mutable arrays, so (rather like Euclid)
it is possible to mechanically transliterate any program in Dijkstra's
notation into, say, a program in the functional language Clean.
More information about the erlang-questions
mailing list