Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Jeremy Fincher" <tweedgeezer@hotmail.com>
To: caml-list@pauillac.inria.fr
Subject: [Caml-list] Self type cannot escape class?
Date: Fri, 13 Jul 2001 11:23:28 -0400	[thread overview]
Message-ID: <F16631JRC1sZV4CllPF00014431@hotmail.com> (raw)

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


                 reply	other threads:[~2001-07-13 15:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F16631JRC1sZV4CllPF00014431@hotmail.com \
    --to=tweedgeezer@hotmail.com \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox