Achieving Referential Transparency
So, if the essence of functional programming is referential transparency, is there any easy rule to follow to preserve it? Yes, there are three functional principles we need to follow: purity, immutability, and totality.
The exact definitions of “referential transparency” and “purity” aren’t universally agreed upon even in academic literature. However, for the purposes of this book, achieving referential transparency is the primary goal of functional programming. In other words, we can measure how functional a piece of code is by its level of referential transparency.
What I mean is that referential transparency is what makes functional programming work. If someone discovers a way to achieve it without using ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access