anchor.diff:              buffer <- History.empty
               remove x
   
  +    type WhileReader<'a>(guard : IMod<bool>, body : IEventReader<'a>) =
  +        inherit AbstractReader<'a>()
  +
  +        let mutable guard = new ModReader<_>(guard) :> IEventReader<_>
  +        let mutable inner : IEventReader<'a> = null
  +        let mutable startTime = None
  +        let mutable endTime = None
  +
  +
  +        override x.IsFinished = Option.isSome endTime
  +
  +        override x.ComputeHistory() =
  +            if not (isNull guard) then
  +                let guardHistory = guard.GetHistory x
  +
  +                for (t,v) in guardHistory.values do
  +                    if v && Option.isNone startTime then
  +                        inner <- body
  +                        startTime <- Some t
  +                    elif not v && Option.isSome startTime then
  +                        guard.Outputs.Remove x |> ignore
  +                        guard.Dispose()
  +                        guard <- null
  +                        endTime <- Some t
  +
  +            if isNull inner then
  +                History.empty
  +            else
  +                match startTime, endTime with
  +                    | Some st, Some et ->
  +                        let all = inner.GetHistory x 
  +                        inner.Outputs.Remove x |> ignore
  +                        inner.Dispose()
  +                        { values = List.filter (fun (t,_) -> t >= st && t <= et) all.values; finished = true}
  +                    | Some st, None ->
  +                        let all = inner.GetHistory x 
  +                        { all with values = List.filter (fun (t,_) -> t >= st) all.values }
  +                    | _ -> 
  +                        History.empty
  +
  +        override x.Release() =
  +            if not (isNull inner) then inner.Dispose()
  +            if not (isNull guard) then guard.Dispose()
  +
   
   
   
  
positive.code:                 | None -> empty
          )
  
  
  module Test =
      
  
  
negative.code:         let newReader () =
              lock readers (fun () ->
                  let r = new EventReaders.EmitReader<'a>(remove)
                  readers.Add r |> ignore
  
                  r :> IEventReader<_>
              )
  