One of the things I got myself for Christmas was Chris Reade's Elements of Functional Programming. Despite being nowhere near done with some other books I'm working through, I cracked it open today. Page three has the following gem: "From this point of view, it is argued that the assignment statement is considered harmful in high-level languages, just as the 'goto' statement was considered harmful for structured programming in the sixties (Dijkstra, 1968). Note that it is the use of assignments that takes most of the blame for not allowing separation of concerns when programming."
That's a pretty bold statement, no? However, Chris Reade is somewhat less widely read than E. Dijkstra; googling for either "assignment considered harmful" (or variants) shows no front page hits that trace back to Reade. Much as I am inclined to agree with that statement, I recognize that my opinion is rooted in many years' experience with the complexities involved in programming with traditional assignment semantics, and have not had nearly as much opportunity to see the downside of purely functional programming.
So what did I find when I googled for "assignment considered harmful?" Well, not much that was actually on topic. The functional programming outlook was represented by this blog post. From a different viewpoint, there was this paper, which looks at four different semantics for "x=y", none of which involves immutable data, and concludes that traditional assignment semantics are the worst of the four options!
No comments:
Post a Comment