Is Referential Transparency Good?

Is Referential Transparency Good?

It makes reasoning about programs easier. It also makes each subprogram

subprogram
The idea of a subroutine was initially conceived by John Mauchly during his work on ENIAC, and recorded in a January 1947 Harvard symposium on "Preparation of Problems for EDVAC-type Machines".
› wiki › Subroutine
independent, which greatly simplifies unit testing and refactoring. As an additional benefit, referentially transparent programs are easier to read and understand, which is one reason for why functional programs need less comments.

What is referential transparency in Python?

Referential transparency: Expressions can be replaced by its values. If we call a function with the same parameters, we know for sure the output will be the same (there is no state anywhere that would change it).

How is referential transparency related to functional side effects?

Another benefit of referential transparency is that it eliminates side-effects from your code. ... Referential transparency requires that functions be free of any code that can modify the program state outside of the function.

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.