[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2010-02-02 (13:36) |
From: | Alain Frisch <alain@f...> |
Subject: | Re: [Caml-list] Thread safe heterogenous property lists (dictionaries) |
On 02/02/2010 14:12, Daniel Bünzli wrote: > The second one uses Maps for logarithmic time lookups. Operations on > dictionaries are thread safe. However key creation is not because > unique ids need to be generated for them. FWIW, a thread-safe way to generate fresh ids is: let fresh_id () = Oo.id (object end) Also, the "perfect" solution you are referring to becomes in the syntax of OCaml's trunk: let embed () (type s) = let module M = struct exception E of s end in (fun x -> M.E x), (function M.E x -> Some x | _ -> None) -- Alain