Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]

From: vc <boston103_at_hotmail.com>
Date: 24 Jun 2005 03:20:15 -0700
Message-ID: <1119608415.186052.250080_at_z14g2000cwz.googlegroups.com>


Marshall Spight wrote:
> vc wrote:
> >
> > Well, referential transparency advantages are common knowledge and the
> > answer to all your questions above are 'yes'(in the first question, it
> > does not matter what you call your output thingy, 'print' or something
> > else, as long as it has a side effect).
>
[...]
> At the same time, there's a common meme that says that "side effects"
> (often meaning either access to global variables or I/O) necessarily
> destroy referential transparency, but that's dicey at best. It doesn't
> distinguish between input/read vs. output/write, and the distinction
> is huge. In essence, a function can output to streams or update
> globals all it wants and it will not alter the return value of the
> function.

Suppose we have a function f(a) defined as returning 2*a. Given the expression x=f(a);x+x we can rewrite it as f(a) + f(a). Now, let's assume that f(a) in addition to doubling its argument prints it. We cannot transform the original expression any more because the argument would be printed twice, the program behaviour would change.
>
> In other words, if we regard print as a function and consider the
> activation of the physical printer to be a side effect, then print
> is still referentially transparent.

No, it is not.

vc
>
> Marshall
Received on Fri Jun 24 2005 - 12:20:15 CEST

Original text of this message