-In addition to order-sensitivity, when you're dealing with mutable variables you also give up a property that computer scientists call "referential transparency." It's not obvious whether they mean exactly the same by that as philosophers and linguists do, or only something approximately the same. What they do mean is a kind of substitution principle, illustrated here:
+In addition to order-sensitivity, when you're dealing with mutable variables you also give up a property that computer scientists call "referential transparency." It's not obvious whether they mean exactly the same by that as philosophers and linguists do, or only something approximately the same.
+
+The core idea to referential transparency is that when the same value is supplied to a context, the whole should always evaluate the same way. Mutation makes it possible to violate this. Consider:
+
+ let ycell = ref 1
+ in let f x = x + !ycell
+ in let first = f 1 (* first is assigned the value 2 *)
+ in ycell := 2; let second = f 1 (* second is assigned the value 3 *)
+ in first = second;; (* not true! *)
+
+Notice that the two invocations of `f 1` yield different results, even though the same value is being supplied as an argument to the same function.
+
+Similarly, functions like these:
+
+ let f cell = !cell;;
+
+ let g cell = cell := !cell + 1; !cell;;
+
+may return different results each time they're invoked, even if they're always supplied one and the same reference cell as argument.
+
+Computer scientists also associate referential transparency with a kind of substitution principle, illustrated here: