(en.wikipedia.org) Referential transparency - Wikipedia

ROAM_REFS: https://en.wikipedia.org/wiki/Referential_transparency

In analytic philosophy and computer science, referential transparency and referential opacity are properties of linguistic constructions, and by extension of languages. A linguistic construction is called referentially transparent when for any expression built from it, replacing a subexpression with another one that denotes the same value does not change the value of the expression. Otherwise, it is called referentially opaque. Each expression built from a referentially opaque linguistic construction states something about a subexpression, whereas each expression built from a referentially transparent linguistic construction states something not about a subexpression, meaning that the subexpressions are ‘transparent' to the expression, acting merely as ‘references' to something else. For example, the linguistic construction ‘_ was wise' is referentially transparent (e.g., Socrates was wise is equivalent to The founder of Western philosophy was wise) but ‘_ said _' is referentially opaque (e.g., Xenophon said ‘Socrates was wise' is not equivalent to Xenophon said ‘The founder of Western philosophy was wise').

Referential transparency, in programming languages, depends on semantic equivalences among denotations of expressions, or on contextual equivalence of expressions themselves. That is, referential transparency depends on the semantics of the language. So, both declarative languages and imperative languages can have referentially transparent positions, referentially opaque positions, or (usually) both, according to the semantics they are given.

The importance of referentially transparent positions is that they allow the programmer and the compiler to reason about program behavior as a rewrite system at those positions. This can help in proving correctness, simplifying an algorithm, assisting in modifying code without breaking it, or optimizing code by means of memoization, common subexpression elimination, lazy evaluation, or parallelization.

Local Graph

org-roam 712f13d2-7769-4807-864b-458f96125f6e (en.wikipedia.org) Referential transp... //en.wikipedia.org/wiki/Analytic_philosophy https://en.wikipedia.org/wiki/Analytic_philosophy 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Analytic_philosophy //en.wikipedia.org/wiki/Computer_science https://en.wikipedia.org/wiki/Computer_science 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Computer_science //en.wikipedia.org/wiki/Rewriting https://en.wikipedia.org/wiki/Rewriting 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Rewriting //en.wikipedia.org/wiki/Denotation https://en.wikipedia.org/wiki/Denotation 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Denotation //en.wikipedia.org/wiki/Contextual_equivalence https://en.wikipedia.org/wiki/Contextual_equivalence 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Contextual_equivalence //en.wikipedia.org/wiki/Declarative_language https://en.wikipedia.org/wiki/Declarative_language 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Declarative_language //en.wikipedia.org/wiki/Imperative_language https://en.wikipedia.org/wiki/Imperative_language 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Imperative_language //en.wikipedia.org/wiki/Programmer https://en.wikipedia.org/wiki/Programmer 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Programmer //en.wikipedia.org/wiki/Compiler https://en.wikipedia.org/wiki/Compiler 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Compiler //en.wikipedia.org/wiki/Rewrite_system https://en.wikipedia.org/wiki/Rewrite_system 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Rewrite_system //en.wikipedia.org/wiki/Correctness_(computer_science) https://en.wikipedia.org/wiki/Correctness_(computer_science) 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Correctness_(computer_science) //en.wikipedia.org/wiki/Algorithm https://en.wikipedia.org/wiki/Algorithm 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Algorithm //en.wikipedia.org/wiki/Optimization_(computer_science) https://en.wikipedia.org/wiki/Optimization_(computer_science) 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Optimization_(computer_science) //en.wikipedia.org/wiki/Memoization https://en.wikipedia.org/wiki/Memoization 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Memoization //en.wikipedia.org/wiki/Common_subexpression_elimination https://en.wikipedia.org/wiki/Common_subexpression_elimination 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Common_subexpression_elimination //en.wikipedia.org/wiki/Lazy_evaluation https://en.wikipedia.org/wiki/Lazy_evaluation 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Lazy_evaluation //en.wikipedia.org/wiki/Parallelization https://en.wikipedia.org/wiki/Parallelization 712f13d2-7769-4807-864b-458f96125f6e->//en.wikipedia.org/wiki/Parallelization 2a07e4ea-610b-4c9a-bb84-d961fb2450e5 Code and Coffee Book Club 2a07e4ea-610b-4c9a-bb84-d961fb2450e5->712f13d2-7769-4807-864b-458f96125f6e