From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 635ABBB84 for ; Sat, 30 Aug 2008 21:29:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEANI8uUjAXQIm/2dsb2JhbAC1f4Fpgy0 X-IronPort-AV: E=Sophos;i="4.32,299,1217800800"; d="scan'208";a="14412590" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 30 Aug 2008 21:29:38 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m7UJTb3H002320 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 30 Aug 2008 21:29:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoICAJg8uUhQRFuwiGdsb2JhbACSRwEBAQ8gowWBaYMt X-IronPort-AV: E=Sophos;i="4.32,299,1217800800"; d="scan'208";a="16422855" Received: from furbychan.cocan.org ([80.68.91.176]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 30 Aug 2008 21:29:37 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1KZW8e-0001rT-98; Sat, 30 Aug 2008 20:29:36 +0100 Date: Sat, 30 Aug 2008 20:29:36 +0100 To: Christophe TROESTLER Cc: caml-list@inria.fr Subject: Re: [Caml-list] What does underscore mean in this type expression? Message-ID: <20080830192936.GB7078@annexia.org> References: <20080830112718.GA25303@annexia.org> <20080830.133831.122629365592826302.Christophe.Troestler+ocaml@umh.ac.be> <20080830130310.GA27910@annexia.org> <20080830.155754.457039520284782231.Christophe.Troestler+ocaml@umh.ac.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080830.155754.457039520284782231.Christophe.Troestler+ocaml@umh.ac.be> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Miltered: at discorde with ID 48B99FA1.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 christophe:01 troestler:01 0100,:01 val:01 mli:01 ocamlc:01 mli:01 ocamlc:01 checker:01 compiler:01 idiom:01 wrote:01 wrote:01 caml-list:01 On Sat, Aug 30, 2008 at 03:57:54PM +0200, Christophe TROESTLER wrote: > On Sat, 30 Aug 2008 14:03:10 +0100, Richard Jones wrote: > > > > > # let x = ref `X;; > > > val x : _[> `X ] ref = {contents = `X} > > > > OK ... so how to get rid of the error? Even supplying a full type for > > get_domains in the implementation doesn't get rid of it. > > > > Here's the code if anyone wishes to try: > > > > http://www.annexia.org/tmp/libvirt.mli > > http://www.annexia.org/tmp/libvirt.ml > > > > $ ocamlc -c libvirt.mli > > $ ocamlc -c libvirt.ml > > Here is the crux of your problem > > let f = let a = ref 0 in fun (x : [> `R ]) -> x;; > > If you hoist [let have_list_all_domains = ref None] outside [let > get_domains], then it works fine. The type checker could certainly be > slightly improved [1] there but I do not know how difficult it is. Yes, that fixed it, thanks. > [1] And maybe also the compiler: a rough check seem to indicate that > hiding the variable in the definition of f is slightly slower. It use this idiom quite a lot to emulate private (static) variables. Rich. -- Richard Jones Red Hat