Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Eliminating array bounds check
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alain Frisch <Alain.Frisch@i...>
Subject: Re: [Caml-list] Eliminating array bounds check
Hello Oleg, wrote:
> For example:

>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