Hi Christian,
here's what I would do :
-I would not make the module name independent from the
filename. Instead, I would have files like this :
File init_Problem_Version_A.ml
File init_Problem_Version_B.ml
File init_Problem.ml
and the contents of File init_Problem.ml would be something like
let current_implementation="A";;
let this_val=match current_implementation with
"A"->Init_Problem_Version_A.this_val
"B"->Init_Problem_Version_B.this_val
|x->failwith("unknown implementation");;
let that_val=match current_implementation with
"A"->Init_Problem_Version_A.that_val
"B"->Init_Problem_Version_B.that_val
|x->failwith("unknown implementation");;
When you want to switch implementations, you
just have to change the definition of "current_implementation"
in one place and then recompile using make.
HTH,
Ewan
--- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, Christian Lerrahn <ocaml
...> wrote:
>
> Hi,
> I have a numerical code that is intialised by functions from only one
> module. As this initialisation depends on my problem, I'd like to
> replace that file every now and then. Now my problem is that I don't
> want to always copy around files which I would have to if I wanted to
> keep the file name (i.e. module name) the same. Therefore I'd like to
> have files init-problema.ml, init-problemb.ml as different files for
> different problems where I just compile/link in the right one in my
> makefile. However, to be able to open the module in my code, I have to
> be able to keep the module name independent from the file name. Is that
> possible at all? If not, does anybody have other suggestions?
>
> Cheers,
> Christian
>
.