[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Sep 15 14:05:03 2003 
Subject:Re: Poplog Dll & Other Issues 
From:David Young 
Volume-ID:1030915.03 

On Fri, 12 Sep 2003, Richard wrote:

> Is there a way to determine if one variable is dependent on another? To
> explain what I mean, image a spreadsheet:
> 
> A1=5  and  A2=A1+2
> 
> When I change A1, the interpreter knows that A2 is a decendent of A1 and
> automatically calculates and displays a new result for A2.
> 
> Anyone have any ideas on how to emulate this behavior in poplog?

I'm also not quite sure what you are asking, as emulating the behaviour
seems different from determining the dependencies.

In case it's relevant, I once wrote a program to maintain a set of
relationships between a set of Pop-11 variables. For the case above,
you'd write this:

    maintain A1 = 5, A2;
        A1 + 2 -> A2;
    endmaintain;

Then you can get this kind of behaviour:

    100 -> A1;
    A2 =>
    ** 102

The statements between maintain and endmaintain are automatically
re-executed as necessary to maintain the relationships between the
variables. These can be expressed in pretty much any Pop-11 code.  
Loopy relationships will cause problems, but indirect relationships are
handled. There are a few restrictions because of the way it's
implemented - e.g. only permanent variables are handled.

The statements are executed only when necessary - so in the case above
the sum 100+2 is done when A2 is printed, not when A1 is updated. (This
is important if you have one variable dependent on several others via a
costly procedure and you want to change several inputs before inspecting
the output.)

I think the library hasn't propagated out of the local tree at Sussex,
but I'll put it on my website if you (or anyone) thinks it might be
useful.

David