* [Caml-list] Why redefinition of modules is forbidden?
@ 2004-07-16 7:02 sjah
0 siblings, 0 replies; only message in thread
From: sjah @ 2004-07-16 7:02 UTC (permalink / raw)
To: caml-list; +Cc: sjah
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-07-16 6:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-16 7:02 [Caml-list] Why redefinition of modules is forbidden? sjah
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox