caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Lauri Alanko <la@iki.fi>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml, objects, classes, type ascription, virtual methods
Date: Mon, 23 May 2011 12:08:47 +0300	[thread overview]
Message-ID: <20110523090847.GB10168@melkinpaasi.cs.helsinki.fi> (raw)
In-Reply-To: <BANLkTimXLL9i1Jqm=J_+MhcHQD7e8EBt2w@mail.gmail.com>

On Mon, May 23, 2011 at 11:40:00AM +0300, Dmitry Grebeniuk wrote:
>   I don't need to inherit the methods (the class' behaviour),
> I only need to be sure that types of methods are equal
> (more precisely, that types of methods of class ext
> can be constrained by types of methods of class base).

Are you sure you need a superclass at all? If you just want to make
sure that certain objects have certain methods, why not simply use
object types in signatures or type annotations?

type base = < m : unit >
class ext = object method m = () end
(new ext : base)


Lauri

  reply	other threads:[~2011-05-23  9:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23  7:50 Dmitry Grebeniuk
2011-05-23  8:29 ` Matthieu Dubuget
2011-05-23  8:40   ` Dmitry Grebeniuk
2011-05-23  9:08     ` Lauri Alanko [this message]
2011-05-23  9:21       ` Dmitry Grebeniuk
2011-05-23 10:11 ` Jacques Garrigue
2011-05-23 10:25   ` Dmitry Grebeniuk

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=20110523090847.GB10168@melkinpaasi.cs.helsinki.fi \
    --to=la@iki.fi \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).