From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4N99XxY018724 for ; Mon, 23 May 2011 11:09:34 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvwAAAwk2k2A1gkBe2dsb2JhbACYJo4QAQEWJgUhwkKGGQSGSpg/ X-IronPort-AV: E=Sophos;i="4.65,255,1304287200"; d="scan'208";a="95197362" Received: from courier.cs.helsinki.fi (HELO mail.cs.helsinki.fi) ([128.214.9.1]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 23 May 2011 11:08:49 +0200 Received: from melkinpaasi.cs.helsinki.fi (melkinpaasi.cs.helsinki.fi [128.214.9.14]) (AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mail.cs.helsinki.fi with esmtp; Mon, 23 May 2011 12:08:47 +0300 id 0008CE13.4DDA241F.00003929 Received: by melkinpaasi.cs.helsinki.fi (Postfix, from userid 37211) id BEE47815A1; Mon, 23 May 2011 12:08:47 +0300 (EEST) Date: Mon, 23 May 2011 12:08:47 +0300 From: Lauri Alanko To: caml-list@inria.fr Message-ID: <20110523090847.GB10168@melkinpaasi.cs.helsinki.fi> References: <4DDA1AD1.9070606@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] ocaml, objects, classes, type ascription, virtual methods 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