Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Thread safe heterogenous property lists (dictionaries)
Date: Tue, 02 Feb 2010 14:36:35 +0100	[thread overview]
Message-ID: <4B682A63.8010101@frisch.fr> (raw)
In-Reply-To: <91a3da521002020512v758849f0mdac3538abac44161@mail.gmail.com>

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



  reply	other threads:[~2010-02-02 13:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 13:12 Daniel Bünzli
2010-02-02 13:36 ` Alain Frisch [this message]
2010-02-03 13:14   ` [Caml-list] " Daniel Bünzli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B682A63.8010101@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox