Version française
Home     About     Download     Resources     Contact us    
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
module:

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

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
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr