Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 5
    Your point about memoization is very good. Note that Haskell strongly emphasizes referential transparency for programming, but the memoization-like behavior of lazy evaluation involves a staggering amount of mutation being done by the language runtime behind the scenes. Commented Apr 25, 2013 at 19:08
  • 1
    @C. A. McCann: I think what you say is very important: in a functional language the runtime can use mutation to optimize the computation but there is not construct in the language that allows the programmer to use mutation. Another example is a while loop with a loop variable: in Haskell you can write a tail recursive function that may be implemented with a mutable variable (to avoid using the stack), but what the programmer sees are immutable function arguments that are passed from one call to the next. Commented Apr 26, 2013 at 5:21
  • @Michael Shaw: +1 for "The problem isn't mutability per se, it's a lack of referential transparency." Maybe you can cite the Clean language in which you have uniqueness types: these allow mutability but still guarantee referential transparency. Commented Apr 26, 2013 at 8:33
  • @Giorgio: I don't really know anything about Clean, although I've heard it mentioned from time to time. Maybe I should look into it. Commented Apr 26, 2013 at 12:07
  • @Michael Shaw: I do not know very much about Clean, but I know that it uses uniqueness types to ensure referential transparency. Basically, you can modify a data object provided that after the modification you have no references to the old value. IMO this illustrates your point: referential transparency is the most important point, and immutability is only one possible way of ensuring it. Commented Apr 26, 2013 at 14:51