anchor.diff:  ﻿namespace Aardvark.Base.Incremental
   
  +open System
  +open System.Threading
  +open System.Runtime.CompilerServices
   open System.Collections.Generic
   open Aardvark.Base
   
   
   type DomainTypeAttribute() = inherit System.Attribute()
   
  +[<AllowNullLiteral>]
  +type Id() =
  +    static let mutable current = 0
  +    let id = Interlocked.Increment(&current)
  +    static member New = Id()
  +    override x.ToString() = sprintf "Id %d" id
  +
  +
  +
   type IUnique =
  -    abstract member Id : int64 with get, set
  +    abstract member Id : Id 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)
  +        if isNull old then
  +            let i = Id()
               u.Id <- i
               i
           else
  
positive.code: 
          member x.Copy = x :> aset<_>
          member x.GetReader() = x.GetReader()
  
negative.code:     member x.Update(keys : pset<'k>) =
          let deltas =
              lock content (fun () -> 
                  let removed = HashSet content
                  let added = HashSet()
                  for k in PSet.toSeq keys do
                      let id = Unique.id k
                      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
  