[PRL] Bob Harper's new blog

Joe Marshall jmarshall at alum.mit.edu
Thu Mar 17 15:07:09 EDT 2011


On Thu, Mar 17, 2011 at 11:12 AM, William D Clinger <will at ccs.neu.edu> wrote:
> What matters for concurrency
> are the side effects, and OO style definitely encourages
> more concurrency-killing side effects than does FP style.

This is an *understatement*.  The `expression' side of OO languages is
often deliberately weakened (I have always assumed it was simple
ignorance, but lately it seems like willful hostility towards FP style).
Important things like sequential evaluation (the `comma operator' from C),
or conditional expressions (the ?: operator) are omitted and this
forces one to use the `statement' version which can only operate
via side effects.

The so-called wealth of libraries generally avoid providing functional
APIs.  This is apparently not an oversight.  Smash and bash is
the standard data manipulation paradigm.  To avoid unexpected
side effects (that is, to abstract them away), you *must* avoid
sharing any data that could *potentially* be shared.  This requires
a lot of defensive copying to ensure unsharing, and OO programmers
still feel that memory management is largely the programmer's
concern (GC notwithstanding).  Basically, a library implementor
will *always* provide imperative APIs because that's how you
program in the language.  But a pure functional API cannot know
in advance what really needs to be copied and what can safely
be shared, so the implementor can either deep copy every argument
on every call, or leave it up to the programmer to decide how
to manage the sharing.

Is it any wonder that `memcpy' is the workhorse of industry programming?
(no joking at all)

-- 
~jrm



More information about the PRL mailing list