caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Objects and private methods
@ 2001-12-21  3:02 Patrick M Doane
  2001-12-21  5:06 ` Jacques Garrigue
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick M Doane @ 2001-12-21  3:02 UTC (permalink / raw)
  To: caml-list

I'm having some trouble getting the following type of structure to
type-check:

  class type a = object method get_b : a end

         and b = object method b : unit end

  class a_impl =
  (object (self)
    method get_b = (self :> b)
    method private b = ()
  end : a)
  ;;

This produces the error message:

  The class type object method b : unit method get_b : b end
  is not matched by the class type a
  The public method b cannot be hidden

The basic idea is that the class 'a_impl' implements 'b' privately. This
seems like something that should be possible to do.  I suspect that the
coercion of self to 'b' is causing the problem here.

I would have expected the failure to occur when coercing to type 'b' as
the method is declared private (which does not match the signature).

Any thoughts?

Thanks,
Patrick

-------------------
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] 4+ messages in thread

end of thread, other threads:[~2001-12-21  8:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-21  3:02 [Caml-list] Objects and private methods Patrick M Doane
2001-12-21  5:06 ` Jacques Garrigue
2001-12-21  5:29   ` Patrick M Doane
2001-12-21  8:40     ` Jacques Garrigue

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