Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit f6150a86 authored by Andrei Paskevich's avatar Andrei Paskevich

rename Hashweak.add to Hashweak.set to stress its one-time semantic

parent 34d2825e
......@@ -54,7 +54,7 @@ let fold fn v =
let h = WHtask.create 63 in
let rewind acc task =
let acc = fn task acc in
WHtask.add h task acc;
WHtask.set h task acc;
acc
in
let current task =
......
......@@ -38,12 +38,12 @@ module Make (S : Util.Tagged) = struct
let mem_tag h = Hashtbl.mem h.table
let find_tag h = Hashtbl.find h.table
let add_tag h t e v =
let set_tag h t e v =
assert (not (mem_tag h t));
Gc.finalise h.final e;
add_tag h t v
let add h e = add_tag h (S.tag e) e
let set h e = set_tag h (S.tag e) e
let mem h e = mem_tag h (S.tag e)
let find h e = find_tag h (S.tag e)
......@@ -53,7 +53,7 @@ module Make (S : Util.Tagged) = struct
try find_tag h t
with Not_found ->
let v = fn e in
add_tag h t e v;
set_tag h t e v;
v
let memoize_option n fn =
......
......@@ -31,8 +31,8 @@ module Make (S : Util.Tagged) : sig
val mem : 'a t -> S.t -> bool
(* test if a key is bound *)
val add : 'a t -> S.t -> 'a -> unit
(* bind the key with the value given *)
val set : 'a t -> S.t -> 'a -> unit
(* bind the key _once_ with the given value *)
val memoize : int -> (S.t -> 'a) -> (S.t -> 'a)
(* create a memoizing function *)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment