anchor.diff:      
   
   /// <summary>
  -/// IncrementalLog logs a the sequence of fundamental adaptive operations
  -/// performed by the system. This allows to investigate bugs and concurrency
  -/// issues. Since this logging is relatively expensive it is disabled by default.
  -/// </summary>
  -module IncrementalLog =
  -    open System.Threading
  -
  -    type Operation =
  -        | StartEvaluate = 1
  -        | EndEvaluate = 2
  -        | StartMark = 3
  -        | EndMark = 4
  -
  -    let private log = List<Operation * int>()
  -    let private logLock = SpinLock()
  -
  -    let append (op : Operation) (o : IAdaptiveObject) =
  -        #if DEBUG
  -        lock log (fun () ->
  -            log.Add(op,o.Id)
  -        )
  -        #else
  -        ()
  -        #endif
  -
  -    let inline startEvaluate(o : IAdaptiveObject) =
  -        append Operation.StartEvaluate o
  -
  -    let inline endEvaluate(o : IAdaptiveObject) =
  -        append Operation.EndEvaluate o
  -
  -    let inline startMark(o : IAdaptiveObject) =
  -        append Operation.StartMark o
  -
  -    let inline endMark(o : IAdaptiveObject) =
  -        append Operation.EndMark o
  -
  -    let getLog() =
  -        log |> Seq.map (fun (op, o) -> 
  -            match op with
  -                | Operation.StartEvaluate -> sprintf "S(%d)" o
  -                | Operation.EndEvaluate -> sprintf "E(%d)" o
  -                | Operation.StartMark -> sprintf "MS(%d)" o
  -                | Operation.EndMark -> sprintf "ME(%d)" o
  -                | _ -> failwithf "unknown operation: %A" op
  -        ) |> String.concat "\r\n"
  -
  -/// <summary>
   /// LevelChangedException is internally used by the system
   /// to handle level changes during the change propagation.
   /// </summary>
  
positive.code:                         Seq.empty
  
                      else
                          try
                              IncrementalLog.startMark e
  
                              // if the object's level has changed since it
                              // was added to the queue we re-enqueue it with the new level
                              // Note that this may of course cause runtime overhead and
                              // might even change the asymptotic runtime behaviour of the entire
                              // system in the worst case but we opted for this approach since
                              // it is relatively simple to implement.
                              if l <> e.Level then
                                  q.Enqueue e
                                  Seq.empty
                              else
                                  match causes.TryRemove e with
                                      | (true, causes) -> causes |> Seq.iter e.InputChanged
                                      | _ -> ()
  
                                  // however if the level is consistent we may proceed
                                  // by marking the object as outOfDate
                                  e.OutOfDate <- true
                  
                                  try 
                                      // here mark and the callbacks are allowed to evaluate
                                      // the adaptive object but must expect any call to AddOutput to 
                                      // raise a LevelChangedException whenever a level has been changed
                                      if e.Mark() then
                                          let mutable failed = false
                                          let callbacks = e.MarkingCallbacks |> getAndClear
                                          for cb in callbacks do 
                                              try cb()
                                              with :? LevelChangedException -> failed <- true
                                          if failed then raise <| LevelChangedException e
  
                                          // if everything succeeded we return all current outputs
                                          // which will cause them to be enqueued 
                                          e.Outputs.Consume()
  
                                      else
                                          // if Mark told us not to continue we're done here
                                          Seq.empty
  
                                  with :? LevelChangedException ->
                                      // if the level was changed either by a callback
                                      // or Mark we re-enqueue the object with the new level and
                                      // mark it upToDate again (since it would otherwise not be processed again)
                                      e.OutOfDate <- false
                                      q.Enqueue e
                                      Seq.empty
                          finally
                              IncrementalLog.endMark e
                  )
  
              // finally we enqueue all returned outputs
  
negative.code:         // when the commit is over we restore the old
          // running transaction (if any)
          running.Value <- old
  
  /// <summary>
  /// defines a base class for all adaptive objects implementing
  