From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA16060; Tue, 24 Sep 2002 14:34:29 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA16066 for ; Tue, 24 Sep 2002 14:34:28 +0200 (MET DST) Received: from athlon.baretta.com (host121-68.pool80116.interbusiness.it [80.116.68.121]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g8OCYQD08129 for ; Tue, 24 Sep 2002 14:34:27 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id D950727399; Tue, 24 Sep 2002 14:43:58 +0200 (CEST) Message-ID: <3D905E0E.5040202@baretta.com> Date: Tue, 24 Sep 2002 14:43:58 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: Henri DF , Ocaml Subject: Re: [Caml-list] choosing modules at runtime References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Henri Dubois-Ferriere wrote: > Say I have a module signature M which is implemented by module structs > M_1, M_2, M_3, .. M_N. > > At runtime , depending on some command-line parameters, I will choose one > of the module implementations (they use different algorithms internally). I do the same in my application. I have a module defining a module type which provider modules must implement. I then dynamically link a cmo specified on the command line, which implements the module type. This file registers the exported functions and values with Registry module, through which they are called and used by the application. Not a simple scheme, but useful and appropriate in my case. > This means my main code will be littered with things like > > if (use algorithm 1) then > M_1.run_algo() > else if (use algorithm 2) then > M_2.run_algo() ... Dynlink solves this problem. But, I'll admit, conditional module expressions would be a cool, cool feature. And I don't believe this requires first class modules. Alex ------------------- 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