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 PAA07443; Thu, 22 May 2003 15:58:00 +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 PAA07667 for ; Thu, 22 May 2003 15:57:59 +0200 (MET DST) Received: from abel.swapping.umh.ac.be (nat.umh.ac.be [193.190.193.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h4MDvwT29191 for ; Thu, 22 May 2003 15:57:58 +0200 (MET DST) Received: from abel.swapping.umh.ac.be ([127.0.0.1] helo=localhost ident=trch) by abel.swapping.umh.ac.be with esmtp (Exim 3.36 #1 (Debian)) id 19Iqc9-00079t-00; Thu, 22 May 2003 16:00:13 +0200 Date: Thu, 22 May 2003 16:00:12 +0200 (CEST) Message-Id: <20030522.160012.37048456.debian00@tiscali.be> To: Damien.Pous@ens-lyon.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] objects and functions From: Christophe TROESTLER In-Reply-To: <20030522102725.1631d979.Damien.Pous@ens-lyon.fr> References: <20030522102725.1631d979.Damien.Pous@ens-lyon.fr> Organization: None X-Spook: top secret enemy of the state ASDIC IMF plutonium Marxist smuggle Treasury S Box DES X-Mailer-URL: http://www.mew.org/ X-Operating-System: GNU/Linux (http://www.linux.org/) X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Mailer: Mew version 3.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; troestler:01 tiscali:99 caml-list:01 damien:01 ens-lyon:01 calc:01 chris:01 christophe:01 inherit:01 match:02 objects:02 wrote:03 object:03 let:04 functions:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 22 May 2003, Damien wrote: > > so, is there a way (or wouldn't it be useful to have one) for doing > something like : > >class a = function > >| 0 -> object method calc = 0 end > >| x -> object method calc = 33 mod x end > or > >class b x = object > > inherit fa x > > ... > >end What about: class a x = let x = match x with 0 -> 0 | x -> 33 mod x in object method calc = x end;; class b x = object inherit (a x) end;; Cheers, ChriS ------------------- 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