From mboxrd@z Thu Jan 1 00:00:00 1970 X-Sympa-To: caml-list@inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q22MLPHc010973 for ; Fri, 2 Mar 2012 23:21:25 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsYBAGFHUU+BZgNImWdsb2JhbABDhT+vByIBAQEBAQgLCwcUJ4InFUA2AgUTAwsCCwMCAQIBWAgBAYgCAQOfV44NijiBL4sTggyBFgSVPpJ2 X-IronPort-AV: E=Sophos;i="4.73,520,1325458800"; d="scan'208";a="134092792" Received: from smarthost2.ircam.fr ([129.102.3.72]) by mail4-smtp-sop.national.inria.fr with ESMTP; 02 Mar 2012 23:21:20 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by smarthost2.ircam.fr (Postfix) with ESMTP id 1A1D982030; Fri, 2 Mar 2012 23:21:20 +0100 (CET) X-Virus-Scanned: amavisd-new at ircam.fr Received: from smarthost2.ircam.fr ([127.0.0.1]) by localhost (smarthost2.ircam.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p1Jvuvu4ipAY; Fri, 2 Mar 2012 23:21:20 +0100 (CET) Received: from increvable.ircam.fr (increvable.ircam.fr [IPv6:2001:660:3004:2:230:48ff:fe29:4f48]) by smarthost2.ircam.fr (Postfix) with ESMTP id E7DE18202E; Fri, 2 Mar 2012 23:21:19 +0100 (CET) Received: from carotte.home.lan (29.127.19.93.rev.sfr.net [93.19.127.29]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: giavitto) by increvable.ircam.fr (Postfix) with ESMTP id BFCAA6D7FD; Fri, 2 Mar 2012 23:21:19 +0100 (CET) Message-ID: <4F5147DE.7020102@ircam.fr> Date: Fri, 02 Mar 2012 23:21:18 +0100 From: Jean-Louis Giavitto Reply-To: jean-louis.giavitto@ircam.fr Organization: UMR STMS 9912 - IRCAM & CNRS User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Validation-by: jean-louis.giavitto@ircam.fr Subject: [Caml-list] Puzzling typing of recursive classes. Hello ocamlers, the following behavior puzzle me. The typing of this fragment: class virtual ['a, 'b] a = object end class virtual ['b] b = object inherit ['b, 'b] a end gives class virtual ['a, 'b] a : object end class virtual ['a] b : object end but the the following code: class virtual ['a, 'b] a = object end and virtual ['b] b = object inherit ['b, 'b] a end returns class virtual ['a, +'b] a : object constraint 'b = 'a end and virtual ['a] b : object end I don't understand why a constraint is added. The difference between the two fragments is that the declaration of class b is in the same "scope" as class a. Anyway, my initial problem is to define two recursive classes (because methods in one refers to object of the other class and vice versa). But I should avoid the collapse of the two type parameters (more precisely, I have 4 type parameters and 3 classes that make some permutation between them). Any idea ? Thank you, Jean-Louis Giavitto.