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 RAA27272; Tue, 3 Aug 2004 17:06:36 +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 RAA27899 for ; Tue, 3 Aug 2004 17:06:35 +0200 (MET DST) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.196]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i73F6YSH009776 for ; Tue, 3 Aug 2004 17:06:34 +0200 Received: by mproxy.gmail.com with SMTP id 75so147164rnl for ; Tue, 03 Aug 2004 08:06:33 -0700 (PDT) Received: by 10.38.206.78 with SMTP id d78mr101103rng; Tue, 03 Aug 2004 08:06:33 -0700 (PDT) Message-ID: Date: Tue, 3 Aug 2004 11:06:33 -0400 From: John Prevost To: Ocaml Mailing List Subject: Re: [Caml-list] Functors and classes In-Reply-To: <20040803131716.GA22773@annexia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20040803120244.GA22304@annexia.org> <20040803121049.GA22418@annexia.org> <20040803131716.GA22773@annexia.org> X-Miltered: at concorde with ID 410FA9FA.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; prevost:01 prevost:01 caml-list:01 functors:01 model:01 dbi:99 dbi:99 struct:01 val:01 val:01 struct:01 sig:01 sig:01 module:03 module:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk The following model works for me. The key problem here is that there's no way to bring a class binding in in the way you want. That's not really a problem, except that you lose the ability to call "new". Perhaps the Dbi interface could be changed to allow for this? (Depending on how you do things, this could mean that a DbiPool could itself be used as a Dbi module, somehow.) It's also possible that I'm missing some way to otherwise do this. John. module TestThing = struct class connection = object method a = 1 method b = 1 method c = 1 end let connect () = new connection end module type ThingIntf = sig type connection val connect : unit -> connection end module type ThingPoolT = sig type connection val connect : unit -> connection end module ThingPool (Thing : ThingIntf) : (ThingPoolT with type connection = Thing.connection) = struct type connection = Thing.connection let connect () = Thing.connect () end module X = ThingPool(TestThing) let x = X.connect () let a = x #a let b = x #b let c = x #c ------------------- 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