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 XAA02746; Tue, 6 Jul 2004 23:37:44 +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 XAA02992 for ; Tue, 6 Jul 2004 23:37:43 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from alex.baretta.com (host244-68.pool80116.interbusiness.it [80.116.68.244]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i66LbgSH003625 for ; Tue, 6 Jul 2004 23:37:42 +0200 Received: from baretta.com (localhost [127.0.0.1]) by alex.baretta.com (Postfix) with ESMTP id A91A32D5ADA; Tue, 6 Jul 2004 17:38:37 -0400 (EDT) Message-ID: <40EB1BDC.90905@baretta.com> Date: Tue, 06 Jul 2004 23:38:36 +0200 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Christian Szegedy Cc: caml-list Subject: Re: [Caml-list] Polymorphic method problem References: <40EAEE20.2010805@t-online.de> In-Reply-To: <40EAEE20.2010805@t-online.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40EB1BA6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; baretta:01 baretta:01 caml-list:01 annotations:01 alex:01 alex:01 polymorphic:01 compile:02 unit:03 unit:03 wrote:03 object:03 object:03 equivalent:05 type:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Christian Szegedy wrote: > Can anyone tell me, why does the following piece of > code fail to compile, and how can I achieve > equivalent effect in the most convenient way? > > class a () = > object(self) > method f : 'a. ((< f : unit; .. > as 'a) -> unit) = fun other -> > other#f method g = (self :> a) > end > > Thanks in advance! > Your type annotations are not correct. Omit the ones which are not strictly needed. class a = object (self) method f : 'a.(( as 'a) -> unit) > as 'a) -> unit) = fun x -> x # f method g = self end Alex ------------------- 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