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 RAA11209; Fri, 13 Jul 2001 17:23:31 +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 RAA11193 for ; Fri, 13 Jul 2001 17:23:30 +0200 (MET DST) Received: from hotmail.com (f166.law15.hotmail.com [64.4.23.166]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f6DFNUj16947 for ; Fri, 13 Jul 2001 17:23:30 +0200 (MET DST) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 13 Jul 2001 08:23:28 -0700 Received: from 172.169.65.172 by lw15fd.law15.hotmail.msn.com with HTTP; Fri, 13 Jul 2001 15:23:28 GMT X-Originating-IP: [172.169.65.172] From: "Jeremy Fincher" To: caml-list@pauillac.inria.fr Subject: [Caml-list] Self type cannot escape class? Date: Fri, 13 Jul 2001 11:23:28 -0400 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 13 Jul 2001 15:23:28.0721 (UTC) FILETIME=[C4835C10:01C10BAF] Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm having a bit of trouble accomplishing what I want to do :) I have two classes, a "poller" class which has methods "add_channel" and "del_channel" to add and remove channels which are polled (with some stuff being done under the hood.) I've got the "channel" class, which I want to be able to accept a poller object in its constructor and call the add_channel function with an argument of "self" in the initializer, and call the del_channel function with an argument of self when it is closed. I am, however, having trouble doing this. I have the two classes defined correctly, and when I don't have the channel class called poller#add_channel or poller#del_channel, it compiles with no errors or warning. When I add the calls to those functions, though (which are necessary for this model to work) I get an error something like this: This expression has type < ... > but is here used with type 'a. Self type cannot escape class. I found a reference to that same error in the manual, section 3.10, but it didn't offer any solutions that worked for me. What do I need to do to make this happen? (Also, as a side note; the channel class has a function defined as "method handle_error () = ()". When not constrained to a type "method handle_error : unit -> unit" the compiler gives this polymorphic type: handle_error : 'a -> 'b. Why is this?) Thanks, Jeremy _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com ------------------- 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