From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
Cc: caml-list@inria.fr
Subject: [Caml-list] Module and structure ...
Date: Mon, 10 Dec 2001 12:03:51 +0100 [thread overview]
Message-ID: <3C149697.676DAD6E@univ-savoie.fr> (raw)
In-Reply-To: <20011209070929.A15616@verdot.inria.fr>
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
prev parent reply other threads:[~2001-12-10 15:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-08 18:50 [Caml-list] SML -> OCaml Jurgen Botz
2001-12-09 6:09 ` Daniel de Rauglaudre
2001-12-10 11:03 ` Christophe Raffalli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3C149697.676DAD6E@univ-savoie.fr \
--to=christophe.raffalli@univ-savoie.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox