Talk:Referential transparency

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
WikiProject Computer science (Rated Start-class, High-importance)
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.

Potential New Source[edit]

I would like to cite this keynote presentation from Rich Hickey (or a transcript thereof) and use ideas from it to improve the quality of this article, and to more efficiently communicate the meaning of the term referential transparency as it pertains to computer science. Any objections to this? Tyler (talk) 14:25, 13 April 2016 (UTC)

Garbled Sentence?[edit]

I don't understand "Without referential transparency, such difference can be easily made and utilized in programs." Is there an example? — Preceding unsigned comment added by (talk) 01:03, 26 May 2016 (UTC)

Program behavior[edit]

I had tagged the lead sentence

This means that a particular expression instance can be replaced with its corresponding value without changing the program's behavior.

with the following clarification request:

An expression can evaluate to the same value in every context, but have a side effect. In this case, replacing it by its value does change the program behavior. A C example is (++g)*0.

Nxvar removed my request and added "John C. Mitchel (2002). Concepts in Programming Languages. Cambridge University Press. p. 78" as a source. I don't have access to this book and hence can't check whether Mitchel requires the expression to be side-effect free, or excludes e.g. changes of global variables from his notion of "program behavior". If none of both restrictions apply, I still insist on my statement made in the clarify request. I suggest the lead should be rephrased accrodingly. - Jochen Burghardt (talk) 19:06, 2 September 2016 (UTC)

  • @Jochen Burghardt: I think Søndergaard, Harald; Sestoft, Peter (1990). "Referential transparency, definiteness and unfoldability" (PDF). Acta Informatica. 27 (6): 505–517. doi:10.1007/bf00277387. had an answer to this question in it. I only quickly skimmed it again, but the definition currently in the article is the "Strachey" definition, which indeed only holds in a side-effect free setting. —Ruud 20:42, 2 September 2016 (UTC)

@Ruud Koot: This article is really hard (philosophical) stuff! What about just mentioning the restriction to a side-effect free setting in the lead, for now? - Jochen Burghardt (talk) 07:40, 3 September 2016 (UTC)

Sure, that would at least make the article a bit more correct. —Ruud 11:19, 3 September 2016 (UTC)

I just noticed that Nxvar also had changed the definition of a referential transparent expression from "all its defined instances produce the same values" to "can be replaced with its corresponding value without changing the program's behavior", thereby resolving my clarification request. Sorry for the confusion! (It might still be helpful to state somewhere in the article that the former is a necessary condition for the latter, and in a side-effect free setting also a sufficient condition, when a good source is available for that.) - Jochen Burghardt (talk) 09:51, 4 September 2016 (UTC)