4 ms·
> Java is referentially transparent Referential transparency is not a property of programming languages but expressions (or more general, parts of computer pro
by valenterry 4y ago
> Java is referentially transparent
Referential transparency is not a property of programming languages but expressions (or more general, parts of computer programs).
> It means that one can replace a reference to a thing with the thing itself.
That's not the common definition at all. Read the link I posted. In any case, I'm talking about evaluatable expressions, you talk about "references" - however you define that.
Even in your own stackoverflow link, the accepted answer says this:
> the thing that an expression refers to
- kaba0 4y agoBut expressions don’t mean the thing they evaluate to, this is an ad hoc meaning used in FP circles only. Is `fibonacci 1000` the integer value it evaluates to? No, it is an expression denoting the calculation of that value. What’s missing from side-effect freedom or pureness? That is the property that allows replacing an expression with its value.
- valenterry 4y ago> But expressions don’t mean the thing they evaluate to, this is an ad hoc meaning used in FP circles only. Is `fibonacci 1000` the integer value it evaluates to? No, it is an expression denoting the calculation of that value. Not sure what you are talking about now. > What’s missing from side-effect freedom or pureness? That is the property that allows replacing an expression with its value. I think you are just unfamiliar with the terminology, that's all. See Wikpedia again: > If a pure function is called with arguments that cause no side-effects, the result is constant with respect to that argument list (sometimes called referential transparency or idempotence), i.e., calling the pure function again with the same arguments returns the same result. (This can enable caching optimizations such as memoization.) (https://en.wikipedia.org/wiki/Functional_programming#Pure_functions https://en.wikipedia.org/wiki/Functional_programming#Pure_fu...) There you go. All 3 terms in once sentence. Maybe, again, you disagree with Wikipedia and the definition and that's your good right, but I don't see any point in prolonging the discussion over that.