From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_10_20,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 88C85BBAF for ; Fri, 27 Mar 2009 15:06:05 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar4BADB6zEnRVcbukWdsb2JhbACCU5JvPwEBAQEJCwoHEQOpOYEHj04BAwEDg3QG X-IronPort-AV: E=Sophos;i="4.38,432,1233529200"; d="scan'208";a="25107716" Received: from rv-out-0506.google.com ([209.85.198.238]) by mail3-smtp-sop.national.inria.fr with ESMTP; 27 Mar 2009 15:06:04 +0100 Received: by rv-out-0506.google.com with SMTP id g9so1156523rvb.3 for ; Fri, 27 Mar 2009 07:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=7qlfHrZHIBiCL8/WmBZ1vyNf6DdgnfHlrXkZOuK64II=; b=Q7abSnUiudUdeRLAjCiNTI8McL353vHn1lF3A5dTSWcS7I8hxcwkC8jcojcA7zxpdo QoS4eaqmex94GngRL1zyElEe0xRHQYBlaRuFkb9j8TJQHCMsWkdYuTPogrz+RpoQVHs9 aGDNWR/Q6DZnTINu6/LFXya+zKMeYU7gzVxH8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=d8zvX4zs97vtTVnwN8XpBuJukWti8BKmlECaJEutmEapO7nimsqLtk1+fQWE7CpEBQ S3L2Ya1ZgCKvOkccYADxjB/52BLT/QcxbiyYn4B08vvGrcHj19Ty8c/euE0TovgFXuTM 1ip7iMX6ta1sT9CUYaHGV3+0TWwEKX1xhRuTg= MIME-Version: 1.0 Received: by 10.114.161.11 with SMTP id j11mr1460389wae.65.1238162763736; Fri, 27 Mar 2009 07:06:03 -0700 (PDT) Date: Fri, 27 Mar 2009 10:06:03 -0400 Message-ID: Subject: class constraints From: Jacques Le Normand To: caml-list caml-list Content-Type: multipart/alternative; boundary=001485f9a4aeb4e68504661a3be6 X-Spam: no; 0.00; foo:01 foo:01 baz:01 abbreviation:01 baz:01 subtype:01 ocaml:01 abbreviation:01 subtype:01 ocaml:01 constraint:01 constraint:01 objects:02 objects:02 constraints:03 --001485f9a4aeb4e68504661a3be6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Dear list, I'm having a little problem understanding constraints in objects. Consider the following code: class type foo = object method get_parent : foo end class type foo2 = object constraint foo2 = #foo method baz : float method get_parent : foo2 end it gives me the following error: The abbreviation foo2 expands to type < baz : float; get_parent : foo2 > but is used with type #foo but foo2 is clearly a subtype of foo. What am I doing wrong? I'm using ocaml 3.10.2 --Jacques Le Normand --001485f9a4aeb4e68504661a3be6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear list,
I'm having a little problem understanding constraints in = objects. Consider the following code:

class type foo =3D
object<= br>=A0 method get_parent : foo
end

class type foo2 =3D
object=
=A0 constraint foo2 =3D #foo
=A0 method baz : float
=A0 method get_pa= rent : foo2
end

it gives me the following error:

The abbre= viation foo2 expands to type < baz : float; get_parent : foo2 >
bu= t is used with type #foo

but foo2 is clearly a subtype of foo. What am I doing wrong? I'm us= ing ocaml 3.10.2
--Jacques Le Normand
--001485f9a4aeb4e68504661a3be6--