[Haskell-cafe] meaning of "referential transparency"

Sergey Bushnyak sergey.bushnyak at sigrlami.eu
Sun Apr 7 00:56:11 CEST 2013


On 04/06/2013 08:43 PM, Henning Thielemann wrote:
>
> Can someone enlighten me about the origin of the term "referential 
> transparency"? I can lookup the definition of "referential 
> transparency" in the functional programming sense in the Haskell Wiki 
> and I can lookup the meaning of "reference" and "transparency" in a 
> dictionary, but I don't know why these words were chosen as name for 
> this defined property.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
I will recommend you book "Modern Compiler Design" by Dick Grune and others.
Besides discussing different topics, authors use Haskell as example for 
describing ideas behind compilers for functional language. Here is 
citation from book on RT, which not explain who coined this term, but 
describes it generally :

"By definition, a function in Haskell defines a fixed relation between 
inputs and out-
put: whenever a function f is applied to the argument value arg it will 
produce the
same output no matter what the overall state of the computation is. 
Haskell, like
any other pure functional language, is said to be “referentially 
transparent” or “side-
effect free.” This property does not hold for imperative languages, 
where assign-
ments to global variables and through pointers may cause two function 
calls f arg to
yield different results, even when the argument value arg is the same in 
both calls.

The good thing about referential transparency is that it simplifies 
program anal-
ysis and transformation since a closed expression always denotes the 
same value
independent of the context, and may be moved around freely. A closed 
expression is
an expression that contains no references to external names other than 
global iden-
tifiers."

-- 
Best regards,
Sergey Bushnyak




More information about the Haskell-Cafe mailing list