In various discussions of the merits of functional programming, the phrase referential transparency or equational reasoning is often listed.

My question is - are these roughly the same thing? (One being the concept, and the second being the process of applying the concept?


1 Answer 1


Referential transparency is an operational notion: it describes what happens when you evaluate a same piece of code (typically a function) several times, namely, the return value is the same. In particular, the evaluation context can generally be ignored when considering the operational semantics of a referentially transparent language.

Equational reasoning is, well, a way to reason about code: it allows you to replace pieces of code with others without worrying about things like evaluation order or current state. This is usually valid because of referential transparency; in general the value of a given code block is dependent on it's context which prevents replacing a piece of code by another regardless of it's position within another block.

In conclusion, referential transparency is a property of the evaluation semantics and the ability to do equational reasoning is a benefit of this property.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.