caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Confused: The example on page 48 where (self :> c) does not work
@ 2001-05-31 19:07 Sarino Suon
  2001-06-05 13:06 ` Didier Remy
  0 siblings, 1 reply; 2+ messages in thread
From: Sarino Suon @ 2001-05-31 19:07 UTC (permalink / raw)
  To: caml-list

Hi, all.

First, let me say that Ocaml is a wonderful language. Its typing
mechanism, though elaborate, appears to be robust, no matter how complex
by data structures become.

There's one problem that defies my understanding, though, and I hope
someone can help. 

I'm trying to understand the example on page 48 of the Ocaml release 3.00
documentation (PDF format). This was to show the case where omitting the
domain of a coercion does not work. Here's the example:

class virtual c = 
	object
		method virtual m:c
	end;;

class c' = 
	object (self) inherit c
		method m = (self :> c)       (* !!! *)
		method m' = 1
	end;;

I don't understand the explanation why the coercion would cause a problem, 
in particular
these two lines of the following paragraph: "On the other hand, in
expression (self :> c) the type of self and the domain of the coercion
above must be unified. That is, the type of the method m in
self (ie. c) is also the type of self. So, the type of self is
c.

It seems, at first blush, that the problem hinges on the special idea of
self-ness. But it seems more involved than this. Can someone help me?

Thank you.

--- Sarino
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-06 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-31 19:07 [Caml-list] Confused: The example on page 48 where (self :> c) does not work Sarino Suon
2001-06-05 13:06 ` Didier Remy

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).