What is “referential transparency” that I hear talked about in computer programming?

490 views

What is “referential transparency” that I hear talked about in computer programming?

In: Technology

3 Answers

Anonymous 0 Comments

“Transparent” in this context means that you can act as if the reference wasn’t there, just like light acts as if transparent glass wasn’t there. You “look” straight through the reference onto the underlying value.

For this to be true, it means that you mustn’t change that value within a function. For example, if you start with x = 5, you can’t reassign it to x = 6 within the code, because the reference x **is the same as 5** by definition. This requirement is the referential transparency.

You are viewing 1 out of 3 answers, click here to view all answers.