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 JAA13733; Tue, 30 Oct 2001 09:10:21 +0100 (MET) 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 JAA13764 for ; Tue, 30 Oct 2001 09:10:20 +0100 (MET) Received: from tet.kurims.kyoto-u.ac.jp ([130.34.73.242]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f9U8AIb03145 for ; Tue, 30 Oct 2001 09:10:18 +0100 (MET) Received: from localhost (localhost [127.0.0.1]) by tet.kurims.kyoto-u.ac.jp (8.11.6/8.11.6) with ESMTP id f9U89KT14029; Tue, 30 Oct 2001 17:09:20 +0900 (JST) (envelope-from garrigue@kurims.kyoto-u.ac.jp) To: andrew@absentis.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Passing self to a new object In-Reply-To: <20011029203036.A1039@alba.sw> References: <20011028155625.A1303@alba.sw> <20011029180207D.garrigue@kurims.kyoto-u.ac.jp> <20011029203036.A1039@alba.sw> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20011030170919O.garrigue@kurims.kyoto-u.ac.jp> Date: Tue, 30 Oct 2001 17:09:19 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Andrew Lawson > > The general solution to this is to first define a class type: > > class type xyz_t = object ('self) > > method > > btnNew : ... > > ... > > end > > Well this gives me an excuse to start playing with types and > interfaces anyway. Is this a 'known problem, will be sorted > eventually' or a 'just live with it' sort of thing? Well, this was delayed for a very long time, but I'm starting to think that we should really do something about it. > > Then change the code in btnNew to > > new abc (self :> xyz_t) > > Casting! and here was I giving a C++ programmer some abuse > about this last week :) No, this is a coercion. This is perfectly type-safe (and checked at compile time). This is needed for type inference. Languages with explicit type information, like Java, do it silently. Cheers, Jacques Garrigue ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr