package timed

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The Time module provides an abstract representation of time, used to set a point from which (monitored) updates to references are recorded to allow undoing/redoing the corresponding changes.

type t

Point in the “timeline” of the program's execution.

val save : unit -> t

save () registers the position of the program in its “timeline”. The returned value can then be used to “time-travel” toward this point, by calling restore. The saving operation runs in constant time. In the process one block of memory of three words is allocated. Note that two consecutive calls to save (i.e., with no interleaved (:=) or restore) return the same value, and the second one does not allocate any memory.

val restore : t -> unit

restore t has the effect of “traveling in time” towards a previously recorded point t. After calling this function, (monitored) reference updates made between t and the “current time” are undone. Note that the time and memory complexity of this function is proportional to the number of (monitored) updates between t and the current time.

OCaml

Innovation. Community. Security.