This is a famous paper on concurrency and the benefits of functional programming. It’s obviously no coincidence that I’ve heard of the author in connection with F#.
For me, a beautiful program is one that is so simple and elegant that it obviously has no mistakes, rather than merely having no obvious mistakes
Simon claims that Haskell is the most beautiful language he knows, then introduces it via an example with side-effects, knowing that the result is quite ghastly to a newbie! He points out that
Being explicit about side effects reveals a good deal of useful information. Consider two functions:
f :: Int -> Int
g :: Int -> IO Int
From looking only at their types we can see that f is a pure function: it has no side effects. In contrast, g has side effects, and this is apparent in its type. Each time g is performed it may give a different result.
I got lost in the middle of the Santa example, but I get the sentiment behind the design:
Since there are no programmer-visible locks, the questions of which locks to take, and in which order, simply do not arise. In particular, blocking (retry) and choice (orElse), which are fundamentally non-modular when expressed using locks, are fully modular in STM.
The book has all the bases covered – history (much is set during World War II), science fiction (time travel) and action (crack troops storming the secret bases of their enemies). I think the plot was excellent, but something was lacking – I found the story telling stodgy in places (particularly at the beginning) and the characters were bland.
Really enjoyed this, it kept me guessing until the last page, with plenty of suspense and excitement. The author interspersed some funny passages too, particularly between the lawyer and his young daughters. This was the first book I’d read by Gimenez, but I will be back for more.