on_update t ~f
is similar to Observer.on_update_exn
, but it does not cause t
to be necessary. Instead of the Initialized
update, there are updates for when a
node becomes Necessary
or Unnecessary
. Here is a state diagram for the
allowable sequences of Update.t
's that can be supplied to a particular f
:
/-----------------------------------------------------\ | / | | | v Start ------> Necessary ----------> Changed ------> Invalidated | | ^ | ^ | ^ | | | /---------/ \--/ | | v | v | \----------> Unnecessary -----------------------------/
If t
gets a new value during a stabilization but is unnecessary at the end of it,
f
will _not_ be called with Changed
, but with Unnecessary
if allowed by the
transition diagram. I.e. if the prior call to f
was with Necessary
or
Changed
, f
will be called with Unnecessary
. If the prior call to f
was with
Invalidated
or Unnecessary
, then f
will not be called.
One should typically use Observer.on_update_exn
, unless the Unnecessary
updates
are needed.
include sig ... end
val sexp_of_t : ('a ‑> Base.Sexp.t) ‑> 'a t ‑> Base.Sexp.t