Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Referential transparency
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Whether a program behaves differently if expressions and their values are interchanged}} {{About|referential transparency in programming language theory|its use in linguistics and philosophy|Opaque context}} In [[analytic philosophy]] and [[computer science]], '''referential transparency''' and '''referential opacity''' are properties of linguistic constructions,{{efn|A linguistic construction (also called mode of containment, context, or operator) is an expression with holes.}} and by extension of languages. A linguistic construction is called ''referentially transparent'' when for any expression built from it, [[Rewriting|replacing]] a subexpression with another one that [[Denotation|denotes]] the same value{{efn|Here a value is the denotation (also called meaning, object, or referent) of an expression, not the [[Expression (computer science)|result]] of the evaluation process.}} does not change the value of the expression.<ref name="quine1960">{{cite book |last=Quine |first=Willard Van Orman |author-link=Willard Van Orman Quine |date=1960 |title=Word and Object |edition=1st |url=https://archive.org/details/in.ernet.dli.2015.529086 |location=Cambridge, Massachusetts |publisher=MIT Press |page=144 |isbn=978-0-262-17001-7}}</ref><ref name="strachey1967">{{cite tech report |last1=Strachey |first1=Christopher |date=1967 |title=Fundamental Concepts in Programming Languages |url= |institution=Lecture notes for the International Summer School in Computer Programming at Copenhagen |number=}} Also: {{cite journal |last1=Strachey |first1=Christopher |date=2000 |title=Fundamental Concepts in Programming Languages |url=https://link.springer.com/article/10.1023%2FA%3A1010000313106 |journal=Higher-Order and Symbolic Computation |volume=13 |issue=1–2 |pages=11–49 |doi=10.1023/A:1010000313106 |s2cid=14124601 |doi-access=|url-access=subscription }}</ref> 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.<ref name="whitehead1927">{{cite book |last1=Whitehead |first1=Alfred North |last2=Russell |first2=Bertrand |author-link1=Alfred North Whitehead |author-link2=Bertrand Russell |date=1927 |title=Principia Mathematica |volume=1 |edition=2nd |url=https://archive.org/details/dli.ernet.247278 |location=Cambridge |publisher=Cambridge University Press |page=665 |isbn=978-0-521-06791-1}}</ref> 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 language]]s and [[imperative language]]s 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 (computer science)|correctness]], simplifying an [[algorithm]], assisting in modifying code without breaking it, or [[optimization (computer science)|optimizing]] code by means of [[memoization]], [[common subexpression elimination]], [[lazy evaluation]], or [[parallelization]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)