|
|
|
|
|
by tylerhou
1546 days ago
|
|
Referential transparency, as the original post says. For example, in a functional language you're always allowed to transform a = f()
b = f()
c = g(a, b)
into a = f()
c = g(a, a)
because f() is guaranteed not to have side effects. (If it does return side effects through the IO monad, instead of actually performing the side effects, g receives two data structures that encode what IO operations to perform.) In an imperative/procedural language, f() may have side effects, and if it does the two programs are not equivalent.This may (not) make programs easier to reason about. |
|