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

From: vc <>
Date: 27 Jun 2005 11:17:58 -0700
Message-ID: <>

Marshall Spight wrote:
> VC wrote:
> >
> > You run your function once, you have one character on a piece of paper,
> > you run your function the next time, you have two characters on a piece of
> > paper.
> This disagreement hinges on whether we consider the character on the
> piece of paper to be part of the return value of the function.
> You do; I don't. To me, it's a *side* effect, and not a return value.
> The return value below is simply the unnamed int, and does not
> include the state of the universe.
> int f(int x) { print "hello"; return x*2; }
> > The *result* of the function execution is different, determined not
> > solely by its arguments but also by the previous state of the world.
> I note that you've again conflated input and output, by saying that
> the function that prints and calculates a value is somehow affected
> by the previous state of the world. It's not, even if you consider
> the printing to be included in the return value. It modifies the state
> of the world by printing, but it doesn't observe it.

No, the function itself of course is not affected. But *the result* which includes the previous run(s) result(s)(or "the state of the world" *is*. That's the whole point.

> > Parenthetically, a more common definition of r.t. is :
> > "An expression E is referentially transparent if any subexpression and its
> > value (the result of evaluating it) can be interchanged without changing the
> > value of E."
> > (,
> > having been used at least since 1977. Whatever definition is used, a
> > side-effect function is clearly not r.t. , be it input, output, assignment ,
> > exceptions and so forth..
> Sure, that definition works fine for me as well, and in fact I
> consulted
> it before my last post.

I am genuinely curious as to how it can work for you since we do not even need to run *the program* including a transformed expression multiple times. Running the program once produces different results whether we/or compiler decides to optimize the program, or not. Please see my very first response to you on the subject: (f(a)+f(a) versus x=f(a); x+x) In the first case you'll see two characters after just one run, in the second, respectively, two.

> > >. I say, give me any function you care to,
> > > and I'll run it on a machine that does output as it executes the
> > > function.
> >
> > I do not understand this. I give you f(x) = 2*x . Why would "the nachine"
> > would ouput anything ?
> Because I told it to.

If you told it to, then it's a different function. If my function is just say f(x)= x*x or whatever, I did not ask the machine to do anything else but map x to x*x. If you decide to include, say, some trace output, then you modified my function by including the 'print' in the function definition. Your virtual machine just does something it was not asked to do, namely, transforms 'x*x' to' x*x; print', for example. In other words, you machine is bug not the intended implementation.

I'll grant you one point though. There is no formal definition of 'referential transparency' that I am aware of. Most widely known are the two informal definitions we used in our discussion. However, even so, I do not see how 'print'(or any output) can be interpreted as referentially transparent even when using the informal defs. The virtual machine example was not convincing for the reason I gave above.


vc Received on Mon Jun 27 2005 - 20:17:58 CEST

Original text of this message