World's most popular travel blog for travel bloggers.

[Solved]: Is Equational Reasoning an application of Referential Transparency?

, , No Comments
Problem Detail: 

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?

Asked By : hawkeye

Answered By : cody

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.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/19297

0 comments:

Post a Comment

Let us know your responses and feedback