ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Talk:Referential transparency (computer science) - Wikipedia, the free encyclopedia

Talk:Referential transparency (computer science)

From Wikipedia, the free encyclopedia

Socrates This article is within the scope of the WikiProject Philosophy, which collaborates on articles related to philosophy. To participate, you can edit this article or visit the project page for more details.
??? This article has not yet received a rating on the quality scale.
??? This article has not yet received an importance rating on the importance scale.

Wouldn't something like getTime() or random() be a better example for something that is free of side effects but not referential transparent?



There should be some more detailed discussion of the possible benefits of referential transparency. For example, call-by-need is difficult to implement without it, as are many optimizations, such as memoization, and other code changes and refactorings.

Also, the use of the word 'enforced' seems strange to me. Perhaps 'guaranteed' would be better?

-- Mark Jason Dominus


The description given in the article seems incorrect to me. Referential transparency is a property of a syntactic element, typically expressions, namely that elaboration of the expression results in the same value independently of location of the expression and time of evaluation. The property is assured if an expression is constructed entirely from constants and applications of pure functions. In particular, functions cannot be referentially transparent, only pure: it is the application of the function which may or may not be transparent.

Also the article describes an impure function which depends on a global variable, but doesn't clearly distinguish this case from a function with side-effects. The C construction termed a function may have side-effects on application, yet still its return value may depend only on its arguments. To account for this, I would use the adjective functional, meaning side-effect free. Referential transparency then depends on application of functions which are both functional and pure, or plainly said just "purely functional". The computer programming language Haskell claims to allow only the construction of purely functional function values, and thus all expressions in Haskell are referentially transparent.

Note that in some languages such as ML, functions are first class and can be passed as values, in this context an expression containing a function being passed as a value could be referentially transparent, even though the function itself depends on variables and has side-effects.

For this reason, the article is dangerously incorrect in attributing referential transparency to a 'function', since it fails to properly distinguish a value of a function type, from the application of such a value. In particular in Ocaml, there is no such thing as a function: equivalent constructions such as

let v = ref 0
let f x = print_endline "Hello"; x + !v
let f = fun x -> print_endline "Hello"; x + !v

are in fact both initialising f with a value of function type, and the expression

 f

is referentially transparent. The application

f 1

is certainly not transparent, and you might say that f is not pure or even functional, but you cannot say that f is not transparent because that is incorrect: the expression f is certainly transparent since it is a constant. In fact, the purity or functional nature of a 'function' refers to a value of function type, there is no such thing as a function in Ocaml, it uses a let-binding to construct values of function type.

In C there are functions, but this is a reference to a syntactic construction used to define a value of function pointer type.

All very tricky and technical, but the bottom line is that referential transparency is a semantic property of the syntactic element 'expression', not a property of a function, indeed it isn't even clear exactly what a 'function' is and the term is probably best avoided altogether in programming contexts.

--Skaller 03:19, 9 August 2005 (UTC)

This article has had some discussion on Lambda the Ultimate (http://lambda-the-ultimate.org/node/view/1237), where they also point out that the definition of on this page is inaccurate. I've tagged the article as having "disputed factual content", since that seemed to be the most appropriate template in Wikipedia:Template_messages. I'll try to improve the article soon, if nobody else does it first. -- Kimbly 23:57, 19 January 2006 (UTC)
There seems to be a better definition of referential transparency on the page about Functional Programming --Randomity 23:51, 21 March 2006 (UTC)

Contents

[edit] removed disputation

I removed the disputation template for the main page because it seems like someone had updated the definition a while back to better reflect what true definition of Referential Transparency is thought to be.--Andrew Eisenberg 22:44, 8 August 2006 (UTC)

[edit] Wrong

The property that this page thinks it discusses has nothing to do with referential transparency. This article is discussing functional purity.

Referential transparency means that symbolic references to bindings are free from surprising interference in the face of code transformation. When the abstract syntax tree is rearranged so that new binding constructs are inserted in the path of the original reference, the bindings thus introduced are invisible to the established references.

Destructive manipulation of variables is perfectly consistent with referential transparency. The issue which affects referential transparency is not the manipulation itself, but rather which variable is manipulated.

Hygienic macros in Scheme are said to be referentially transparent, since a macro body can refer to lexical variables defined in its surrounding lexical scope without worry about capture by material that is inserted into the macro body from the macro arguments, or material that appears in the lexical scope of the site where the macro is expanded. —The preceding unsigned comment was added by 154.5.38.40 (talk) 02:55, 11 April 2007 (UTC).


[edit] Incomplete

This page sucks. It is seriously incomplete. It does not represent the use of the term referential transparency in any domain other than computing (and there are many others. Note that this article is a Category:Philosophy article). I even went so far as to add a lot of relevant content to the page on "Opaque Contexts" and redirected the page there, and was reverted. Weak. Last time I help this shithole website.38.100.212.21 (talk) 03:37, 21 November 2007 (UTC)

[edit] watcing

when someone is looking at somebody else —Preceding unsigned comment added by 77.99.132.139 (talk) 18:03, 27 February 2008 (UTC)


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -