Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Does Codd's view of a relational database differ from that ofDate&Darwin?[M.Gittens]

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

From: VC <boston103_at_hotmail.com>
Date: Sat, 25 Jun 2005 00:21:38 -0400
Message-ID: <0cudnW54g-NORiHfRVn-gA@comcast.com>

"Marshall Spight" <marshall.spight_at_gmail.com> wrote in message news:1119661268.380487.23320_at_g47g2000cwa.googlegroups.com...
> vc wrote:

>> Marshall  Spight wrote:
>> >
>> [...]
>> > 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.
>

> "Referential transparency: In computer programming, a referentially
> transparent function is one that, given the same parameter(s), always
> returns the same result."
>

> So what are you testing the referential transparency of, f or the
> program? In your example, the return value of f(a) was defined
> as 2*a, which it will be, whether f() prints or not. So f is
> referentially transparent, by definition.
>

> If you want to expand the definition of function such that its outputs
> include the state of all global variables and all output streams,
> then it would no longer meet the definition, but you'd have to then
> say that the definition of f() is "append X to the printer stream and
> return 2*a."

I do not need "to expand the definition of function". Including side effect treatment is a commonly accepted is a standard approach and has been such for many years. One *must* include the notion of state because that's exactly what a function with side effects does, changes the state.

>I don't think such a definition would be very useful,

Au contraire, ignoring side effects in a hypothetical computational model would be extremely strange, to say the least. I do not wish to discuss the subject of side effects and referential transparency in general any further since it's been hashed and rehashed many times . One can consult any decent book on FP or denotational semantics for further info.

.
> but maybe it would be in the right context.

>

> The further problem then comes with the fact that your program
> can't know whether it's running on a virtual machine of some
> kind, and perhaps that virtual machine calls a print function
> each time a method is called. With the expanded definition of
> function, it is impossible to know what the outputs of a function
> are without considering not only the function but the machine
> it is running on. Of course, *that* machine could be running on
> a virtual machine, so you have to talk that into account as well.

So what's you point re. the virtual machine ? We do not need to anything of the kind you describe. There are several ways to handle side effects in FLs including monads, continuation passing , the notion of the "unique world" in Clean, etc.). Received on Fri Jun 24 2005 - 23:21:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US