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 SAA10253; Fri, 19 Sep 2003 18:22:54 +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 SAA22827 for ; Fri, 19 Sep 2003 18:22:53 +0200 (MET DST) Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h8JGMpH06329 for ; Fri, 19 Sep 2003 18:22:52 +0200 (MET DST) Received: (qmail 21925 invoked from network); 19 Sep 2003 16:22:49 -0000 Received: from unknown (HELO apprentice.genxnet.com) ([64.81.145.152]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 19 Sep 2003 16:22:49 -0000 Date: Fri, 19 Sep 2003 11:32:07 -0500 From: art yerkes To: caml-list@inria.fr Subject: Re: [Caml-list] Subclasses and pattern matching Message-Id: <20030919113207.14fbae30.ayerkes@speakeasy.net> In-Reply-To: <20030919155431.GA31387@henchmonkey.org> References: <20030919142156.GA30187@henchmonkey.org> <20030919145220.GD4205@redhat.com> <20030919152252.GA30989@henchmonkey.org> <20030919105852.24b1ea03.ayerkes@speakeasy.net> <20030919155431.GA31387@henchmonkey.org> X-Mailer: Sylpheed version 0.8.11 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; yerkes:01 ayerkes:01 caml-list:01 yerkes:01 extern:01 extern:01 coca-ml:01 coca-ml:01 index-en:01 speakeasy:01 sep:01 typechecker:02 match:02 subclasses:02 exception:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 19 Sep 2003 11:54:31 -0400 katre wrote: > art yerkes wrote: > > You could wrap your items in a union: > > > > exception NoExternalRepForBase > > > > type 'a base_extern_t = > > Derived1 of 'a | Derived2 of 'a > > > > class virtual base = > > object > > method virtual as_external : unit -> base base_extern_t > > end > > > > Will this allow me to call methods that only exist on the derived > classes after the pattern match? I'm not sure this type lets the > typechecker know exactly which derived class I have. > > katre I've heard that coca-ml does the rest (though I haven't tried it myself). http://www.pps.jussieu.fr/~emmanuel/Public/Dev/coca-ml/index-en.html -- "Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." - S. Kelly-Bootle ------------------- 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