Re: views of binary operations

From: erk <eric.kaun_at_gmail.com>
Date: 17 Jul 2006 04:47:35 -0700
Message-ID: <1153136855.570462.180130_at_75g2000cwc.googlegroups.com>


Bob Badour wrote:
> Marshall wrote:
>
> > Consider named views of binary operations on relations.
> >
> > Given a relational operator "op" and relation variables A and B,
> > and a declaration of:
> >
> > r = A op B
> >
> > the language evaluates the expression "A op B" and assigns the
> > result to r.
> >
> > However, if we declare this as a view, we do not evaluate A op B
> > at the time of the declaration, but instead (re)evaluate A op B each
> > time we make reference to r in later expressions.
> >
> > r = view(A op B)
> >
> > Is it the case that we want exactly the above, or might we
> > want a more fine-grained control? Might we ever want
> >
> > r = A op view(B)
> >
> > In other words, the value of A at the time of the declaration and
> > value of B at the time of evaluations of r? In which case, we
> > then have four possibilities:
> >
> > r = A op B
> > r = view(A) op B
> > r = A op view(B)
> > r = view(A) op view(B)
> >
> > (Actual evaluation of the expression is deferred if either of
> > the operands is a view.)
> >
> > In other words, when we have a view of a binary relation operation,
> > are we necessarily creating a view of the entire expression, or are
> > we making views of the operands?
>
> I cannot make sense of what you are asking. Are you confusing views and
> snapshots by any chance?

At the risk of repeating what you already know, I think Marshall intends the unadorned assignment (r = A op B) to assign a value (snapshot) to r. But the view doesn't assign a value to r - it's a lazy evaluation (but without the closure that usually goes along with it). The hybrids are partial lazy evaluations - as such, I guess they're closures. For example, "r = view(A) op B" closes over B, capturing its value at the time this statement is evaluated, but only "capturing" A's value when the value of r is used. So a temporary, local snapshot is created.

I suppose it's like an object, in that you don't have referential transparency, like in:

    c1 = b.c // c1 ref now "points" to b's c instance     print(c1.something) // output
    // time passes, something else changes c.something     print(c1.something) // different output

Just early-morning ramblings...

  • erk
Received on Mon Jul 17 2006 - 13:47:35 CEST

Original text of this message