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 OAA20017; Tue, 3 Aug 2004 14:02:46 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA20322 for ; Tue, 3 Aug 2004 14:02:45 +0200 (MET DST) Received: from annexia.force9.co.uk (annexia.force9.co.uk [212.56.101.183]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i73C2iSH018936 for ; Tue, 3 Aug 2004 14:02:45 +0200 Received: from rich by annexia.force9.co.uk with local (Exim 3.36 #1 (Debian)) id 1Bry0C-0005on-00 for ; Tue, 03 Aug 2004 13:02:44 +0100 Date: Tue, 3 Aug 2004 13:02:44 +0100 To: caml-list@inria.fr Subject: [Caml-list] Functors and classes Message-ID: <20040803120244.GA22304@annexia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones X-Miltered: at concorde with ID 410F7EE4.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; functors:01 functorized:01 functors:01 dbi:99 dbi:99 postgres:01 postgres:01 mli:01 mli:01 val:01 autoconf:01 automake:01 compiles:01 rpms:01 ltd:98 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm trying to replace the current mod_caml approach to pooling database handles with a functorized one. However there seems to be some problem with the way functors and classes interact. I have a hierarchy of classes: Dbi.connection | ^ | +----------- - - - etc. | Dbi_postgres.connection I'd like to create a pool of "postgres connections" using something like: module MyPool = Apache.DbiPool (Dbi_postgres) So far, the apache.mli looks like below. It doesn't compile because: Unbound type constructor DbiConnection.connection at the last line. Is this sort of thing even possible? Rich. ------------------------------------------------------- apache.mli --------- module type DbiConnection = sig class connection : ?host:string -> ?port:string -> ?user:string -> ?password:string -> string -> object method close : unit -> unit method closed : bool method ping : unit -> bool method rollback : unit -> unit end end module type DbiPoolT = sig type connection val get : Request.t -> ?host:string -> ?port:string -> ?user:string -> ?password:string -> string -> connection end module DbiPool (Dbi : DbiConnection) : DbiPoolT with type connection = DbiConnection.connection ---------------------------------------------------------------------- -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles, RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/ ------------------- 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