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 AAA00367; Fri, 20 Jun 2003 00:16:50 +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 AAA00696 for ; Fri, 20 Jun 2003 00:16:48 +0200 (MET DST) Received: from kraid.nerim.net (smtp-104-thursday.nerim.net [62.4.16.104]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h5JMGmT02917 for ; Fri, 20 Jun 2003 00:16:48 +0200 (MET DST) Received: from karryall.dnsalias.org (karryall.dnsalias.org [62.4.18.180]) by kraid.nerim.net (Postfix) with ESMTP id 5DCC640F7B; Fri, 20 Jun 2003 00:16:46 +0200 (CEST) Received: by karryall.dnsalias.org (Postfix, from userid 500) id 88ED81A0038; Fri, 20 Jun 2003 00:16:45 +0200 (CEST) Message-ID: <16114.13901.291072.769049@karryall.dnsalias.org> Date: Fri, 20 Jun 2003 00:16:45 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Olivier Andrieu To: Nick Name Cc: caml-list@inria.fr Subject: Re: [Caml-list] Mutually recursive types and classes In-Reply-To: <20030619194557.0b5265bb.nick.name@inwind.it> References: <20030619194557.0b5265bb.nick.name@inwind.it> X-Mailer: VM 7.16 under Emacs 21.2.1 X-Spam: no; 0.00; andrieu:01 caml-list:01 inherit:01 olivier:02 redefine:02 unit:03 classes:03 recursive:03 object:03 types:03 parameter:04 definition:06 type:07 jussieu:07 mutually:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Nick Name [Thursday 19 June 2003] : > Hi all, > > I wish to declare a type like > > type a = A of (b -> unit) | ... > > where b is a class like > > class b = > object (this) > method f : a -> unit = > function > A f -> f this > | _ -> unit > end > > or, alternatively: > > class b = > object > inherit [a] otherclass > ... > end > > How can I do such a thing, considering that I can't write an "and" > keyword between a type declaration and a class (or class type) > declaration? You could add a type parameter in your definition of a : type 'a a = A of ('a -> unit) | ... and then class b = object (this : 'a) method f : 'a a -> unit = ... end or class b = object method f : b a -> unit = ... end and eventually redefine a : type a = b a -- Olivier ------------------- 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