caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Self type cannot escape class?
@ 2001-07-13 15:23 Jeremy Fincher
  0 siblings, 0 replies; only message in thread
From: Jeremy Fincher @ 2001-07-13 15:23 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-07-13 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-13 15:23 [Caml-list] Self type cannot escape class? Jeremy Fincher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).