Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] choosing modules at runtime
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] choosing modules at runtime
You can use records :

type t = {
	f1 : int -> int
	f2 : string -> int
	...
}	

let module1 = 
	let ...
	  (* whatever you want *)
	in
	{
	f1 = ... ;
	f2 = ... ;
	...
	}

let module2 = 
	let ...
	  (* whatever you want *)
	in
	{
	f1 = ... ;
	f2 = ... ;
	...
	}

let algo = if cond then module1.f1 else module2.f2

-- 
Maxence Guesdon
-------------------
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