Re: OO versus RDB

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sun, 09 Jul 2006 21:05:59 GMT
Message-ID: <Xcesg.8403$pu3.187928_at_ursa-nb00s0.nbnet.nb.ca>


Marshall wrote:

> Bob Badour wrote:
>

>>Marshall wrote:
>>
>>>[...] return values are not
>>>affected by writing to global variabes.
>>
>>Observable effect, on the other hand, is affected.

>
> Oh, certainly. The interesting question in my mind is how does
> one distinguish observable effects that matter from those
> that don't matter? Sometimes one introduces a write into
> a function or procedure or whatever-you-want-to-call-it,
> solely for the purposes of seeing when it is actually invoked;
> if doing so triggers a host of changes in how the function
> is treated, this defeats the purpose. On the other hand,
> perhaps sometimes an output is intended to occur regardless
> of whether the enclosing expression might otherwise be
> optimized away. It is my suspicion that much more output
> falls in to the first category than the second than is typically
> appreciated, but it is only a suspicion at this time.
>
>
>
>>Thus, such a function is not a pure function according
>>to the definitions I have seen.

>
> I have not observed that the use of "referential transparency"
> and "purity" is entirely consistent. If we go by what wikipedia
> says at the time of this writing, referential transparency means
> side-effect-free and pure, side-effect-free means no outputs
> other than return values, pure means return values depend
> solely on parameters.
>
> I also find it funny that *all* outputs are called "side-effects"
> regardless of whether they are of primary concern or not:
> it seems disingenuous to me to call the fact that
> "printf("hello, world\n");" writes to standard out
> a *side* effect. I mean, what is it to the side *of*?

It is to the side of 13, 14 or some negative value, which is return value of the function.

>>Now, if the variable were a static variable not
>>observable outside the function, then it would be pure.

>
> Yes, this gets at another point that is often glossed over:
> what is an observable effect is entirely dependent on
> context. Since that's true, it means that if we go by the
> above definitions, then if we have a pure function,
> whether it is referentially transparent is a matter of
> context! We could for example have an entirely pure
> program that performs no output (only returning a
> value at exit) and be able to run it on a virtual machine
> that writes to a log file at every function entry point.
> Is it referentially transparent? From the viewpoint
> of the program itself, yes; from the viewpoint of the
> entire system, no. However if you point out to people
> that their definition of referential transparency is
> context dependent, some of them will get very angry.

Not me. I would merely observe that it is the virtual machine rather than the pure program that lacks referential transparency.

> The fact that raising these points gets so many people
> so riled up indicates to me that not everyone is thinking
> entirely clearly about the issues, and that indicates that
> there are opportunities to advance the state of the art.

Humans tend to subjectivity. I am not sure what we can do about that. Received on Sun Jul 09 2006 - 23:05:59 CEST

Original text of this message