Tue Mar 23 15:45:20 CET 2010

Lazy vs. Reactive

So.. What do we have?  3 kinds of nodes:

     - lazy evaluation: eval once when needed
     - reactive: re-eval when needed (dependency-based)
     - thunk: re-eval always

The lazy scheme works quite well.  The dependency-based caching
however is a mess.  It currently doesn't compose; it should propagate
requests to its leaves and trigger recompile if necessary.

How to make it composable?  It is a simple issue of making
dependencies explicit.

  ( The main point for sweb is that you can't place a reactive
    component inside a lazy one. )

Functional reactive programming (FRP) usually takes one of 2

        - pull: each query propagates to primitive sources and
          recomputes as necessary.

        - push: each event pushes through the dependency network to
          create new high-level events.

Since the web is a pull architecture, I'm not sure if push is so
interesting.  However, if push events are available, one could
re-compute to lower latency on the pull side.

Ideally, at an exit node, you want to know _all_ its dependencies and
check if it needs to be recomputed.  

What you want is for dependency information to travel separately from
the value path.  Specifying it explicitly is tedious.  How to automate
this in Scheme?  

Probably having some dynamic environment to record the evaluation
trace is a good approach.  Can we assume the trace to be static?  That
way it can be computed the first time a full evaluation is made.

Alternatively: can it be done in syntax? (fully static dependency).

[1] http://en.wikipedia.org/wiki/Functional_reactive_programming
[2] http://en.wikipedia.org/wiki/Incremental_computing