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
[Caml-list] SML -> OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <Christophe.Raffalli@u...>
Subject: [Caml-list] Module and structure ...

I am using module in a very extensive way in a program ... and I do not see
anything you can do
with structure taht you can not do with structure.

The only problems are syntactic (and I hope they will be fixed soon):

M(A).fied has to be written 
let module X = M(A) in X.field

functor (x:type) -> struct . . . end has to be written
functor (X:sig x:type end) -> struct open X... end (with extra modifications to
call the functor)

But then you can "open" a structure, share labels, use subtyping, and so on ...

Actually the "open M in" feature is missing but can be simulated by creating a

open M in P := let module Result = struct open M let result = P end in

So why not adding this open M in feature and the two others above has they are
only (almost) syntactic sugar ?


And then, why not replace structures by modules ? It would simplify the
compiler ?

would it be less efficient ? If yes, isn't it just a matter of optimisation ?


And then the next step is to merge module and object ... It may no be so
difficult but this looks
like research topic ...
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
Bug reports:  FAQ:
To unsubscribe, mail  Archives: