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 UAA31425; Tue, 3 Feb 2004 20:37:30 +0100 (MET) 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 UAA32095 for ; Tue, 3 Feb 2004 20:37:28 +0100 (MET) Received: from mz2.forethought.net (mzpi4.forethought.net [216.241.36.13]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i13JbRP17441 for ; Tue, 3 Feb 2004 20:37:27 +0100 (MET) Received: from [216.241.35.41] (helo=swordfish) by mz2.forethought.net with esmtp (Exim 4.14) id 1Ao6MQ-00013h-6F for caml-list@pauillac.inria.fr; Tue, 03 Feb 2004 12:37:26 -0700 Received: from matt by swordfish with local (Exim 3.35 #1 (Debian)) id 1Ao6MS-0002Lg-00 for ; Tue, 03 Feb 2004 12:37:28 -0700 Date: Tue, 3 Feb 2004 12:37:28 -0700 From: Matt Gushee To: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] functors and objects Message-ID: <20040203193728.GA7367@swordfish> Reply-To: Matt Gushee Mail-Followup-To: caml-list@pauillac.inria.fr References: <20040203190635.6cc61ff0.Damien.Pous@ens-lyon.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040203190635.6cc61ff0.Damien.Pous@ens-lyon.fr> User-Agent: Mutt/1.3.27i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; gushee:01 gushee:01 caml-list:01 functors:01 2004:99 damien:01 sigh:01 casts:01 struct:01 englewood:01 manure:01 mgushee:01 havenrock:01 havenrock:01 ignores:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Feb 03, 2004 at 07:06:35PM +0100, Damien wrote: > > I would like to write something like > > << > class type o = > object > method react: unit > end > > module type O = > sig > type t :> o (* sigh... *) > end The first problem is that you're mixing type declarations and class casts ... not a hard mistake to make, since the class cast syntax is a bit confusing, and doesn't seem to be explained very well anywhere. Anyway, you seem to have missed the simplest solution: module type O = sig type t = o end > module R(M: O') = > struct > include R(M) I don't see how this can work, because this module R takes an argument of type O', whereas the other R (do you really want to give them the same name?) takes an argument of type O. Regardless of their contents, they are different interfaces and thus not interchangeable. There's undoubtedly a way to achieve the result you want, but I don't really understand what you are trying to do. Do you actually have a specific goal in mind, or are you just experimenting? -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- 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