anchor.diff:      member x.Update(keys : pset<'k>) =
           let deltas =
               lock content (fun () -> 
  -                let removed = HashSet store.Values
  +                let removed = HashSet content
                   let added = HashSet()
                   for k in PSet.toSeq keys do
                       let id = Unique.id k
  -
  -                    match store.TryGetValue id with
  -                        | (true, v) -> 
  -                            update(v, k)
  -                            removed.Remove v |> ignore
  -                        | _ ->
  -                            let v = create k
  -                            store.Add(id, v)
  -                            added.Add v |> ignore
  +                    let v = cache.GetOrCreate(k, create)
  +                    if not (removed.Remove v) then 
  +                        added.Add v |> ignore
   
                   [
                       yield! added |> Seq.filter content.Add |> Seq.map Add
  
positive.code: ﻿namespace Aardvark.Base.Incremental
  
  open System.Collections.Generic
  open Aardvark.Base
  
  
  type DomainTypeAttribute() = inherit System.Attribute()
  
  type IUnique =
      abstract member Id : int64 with get, set
  
  module Unique = 
      open System.Threading
      let mutable private currentId = 1L
  
      let id (u : IUnique) =
          let old = u.Id
          if old = 0L then
              let i = Interlocked.Increment(&currentId)
              u.Id <- i
              i
          else
  
negative.code: 
          member x.Copy = x :> aset<_>
          member x.GetReader() = x.GetReader()
  
  
  type ReuseCache() =
  
      let version = ref 0L
      let store = Dict<Type, IReuseCache>()
  
      member x.GetCache<'a>() =
          let dict = store.GetOrCreate(typeof<'a>, fun t -> ReuseCache<'a>() :> IReuseCache)
          dict |> unbox<ReuseCache<'a>>
  