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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B8A24BB83 for ; Mon, 4 Sep 2006 09:22:29 +0200 (CEST) Received: from smtp2-g19.free.fr (smtp2-g19.free.fr [212.27.42.28]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k847MTbX001044 for ; Mon, 4 Sep 2006 09:22:29 +0200 Received: from [192.168.0.1] (rke75-3-82-229-183-156.fbx.proxad.net [82.229.183.156]) by smtp2-g19.free.fr (Postfix) with ESMTP id 2265575BBA; Mon, 4 Sep 2006 09:22:27 +0200 (CEST) Message-ID: <44FBD432.8030602@inria.fr> Date: Mon, 04 Sep 2006 09:22:26 +0200 From: Alain Frisch User-Agent: Thunderbird 1.5.0.5 (X11/20060812) MIME-Version: 1.0 To: oleg@pobox.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Eliminating array bounds check References: <20060904010002.9A553AC00@Adric.metnet.fnmoc.navy.mil> In-Reply-To: <20060904010002.9A553AC00@Adric.metnet.fnmoc.navy.mil> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 44FBD435.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 oleg:01 oleg:01 sig:01 val:01 struct:01 ocaml:01 functors:01 applicative:01 ocaml:01 functor:01 sig:01 val:01 struct:01 Hello Oleg, oleg@pobox.com wrote: > For example: > http://pobox.com/~oleg/ftp/ML/eliminating-array-bound-check-literally.ml >>From your code: ======================================= (* First, we, on off-chance, check if we can obtain type eigen-variables via the module system. *) module GenT : sig type t val v : t end = struct type t = int let v = 1 end ;; let module M1 = GenT in let module M2 = GenT in M1.v = M2.v ;; (* Alas, the latter succeeds and reports no type error. What did we expect: OCaml functors are applicative. Fortunately, OCaml supports higher-rank types. *) ======================================= What about making GenT a functor and passing it unnamed structures as arguments? (Ok, you must then trust the client not to apply GenT with named structures.) module GenT(X:sig end) : sig type t val v : t end = struct type t = int let v = 1 end ;; let module M1 = GenT(struct end) in let module M2 = GenT(struct end) in M1.v = M2.v ;; You could then simplify the TrustedKernel so as not to use polymorphic record fields (and also to use a direct style instead of a continuation style for brand). -- Alain