From: sjah@land.ru
To: caml-list@inria.fr
Cc: sjah@land.ru
Subject: [Caml-list] Why redefinition of modules is forbidden?
Date: Fri, 16 Jul 2004 11:02:04 +0400 (MSD) [thread overview]
Message-ID: <200407160702.i6G724f0023964@www3.pochta.ru> (raw)
Hello!
How to do following thing the best way?
I have to extend old module and its submodule with some
new functions. Old module is big enouth.
This method doesn't work due to %subj%:
module X =
struct
let f1 = ...
let f2 = ...
...
let f99 = ...
module Y =
struct
let f1 = ..
let f2 = ..
...
let f99 = ...
end
end
module ExtX =
struct
include X
let f100 = ...
...
let f199 = ...
module Y =
struct
include Y
let f100 = ...
...
let f199 = ...
end
end
Multiple definition of the module name Y.
Names must be unique in a given structure or signature.
Following approach works, but it is hard to maintain
big module type signature to reflect changes in X and Y.
module X =
struct
let f1 = ...
let f2 = ...
...
let f99 = ...
module Y =
struct
let f1 = ..
let f2 = ..
...
let f99 = ...
end
end
module type X_without_Y =
sig
val f1 ; ...
val f2 : ...
...
val f99 : ...
end
module ExtX =
struct
include (X : X_without_Y)
let f100 = ...
...
let f199 = ...
module Y =
struct
include X.Y
let f100 = ...
...
let f199 = ...
end
end
-------------------
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
reply other threads:[~2004-07-16 6:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200407160702.i6G724f0023964@www3.pochta.ru \
--to=sjah@land.ru \
--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;
as well as URLs for NNTP newsgroup(s).