Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCaml 3.05 released
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <raffalli@u...>
Subject: [Caml-list] Record with one non mutable filed

How are compiled record with only one non mutable field ? are they
removed ?

In Ocaml 3.05, record with only one non mutable field may be used in the
following way:

type 'a foo = 
  A of int
| B of 'a

type bar = { value : 'a.'a foo }

this means that type bar is somehow a subtype of type foo (constructor B
being removed.

then I think (but may be wrong) that an expression as

let b = { value = A 3 } could be compiled as 
let b = A 3

Is this optimization performed ? (I know this is not very important for
efficiency ... but I am just curious)
-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners