[
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: | 2006-09-04 (07:22) |
From: | Alain Frisch <Alain.Frisch@i...> |
Subject: | Re: [Caml-list] Eliminating array bounds check |
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