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=0.0 required=5.0 tests=HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 40C22BBAF for ; Thu, 10 Jul 2008 15:43:24 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtwAAMSudUjRVciod2dsb2JhbACCPzOPJkMBDAMICREDlz+HCA X-IronPort-AV: E=Sophos;i="4.30,338,1212357600"; d="scan'208";a="27202664" Received: from wf-out-1314.google.com ([209.85.200.168]) by mail4-smtp-sop.national.inria.fr with ESMTP; 10 Jul 2008 15:43:22 +0200 Received: by wf-out-1314.google.com with SMTP id 24so3528340wfg.15 for ; Thu, 10 Jul 2008 06:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=a5Ig4flJel3QUb+YfKebipPd6EQbh4dVGrmcheTzdC4=; b=V1rwqBnZLYxxlYCcCXLI6SQfQAYT0fVRt4yOBaB62TvqlrtiUlBXsKlrJUaID7jtp4 ihQbMQNHyG1jHUAdufufwbV+wOduRJLlWi9lwO95a/oxkThwhWUSQNJnK/ENEYhZ1Y+M 4lCoxJbm1q1As/o7+DPEl9+Bc4UoXBENzYXP4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=dVaEwajI1Z13icw1ZA6nHQZwD/lrYgtEVAGOYOvaQ3Y0F5V3ye1Qlaa62ltYfUPri7 bVeokGV/bkKvZ1tRsP9RyRZ9KMwNNEX3RJ6vf9gt2VFx4xk4dV+mL5mVLggEea6xdN11 ynPrKBeqCpNcij9bq+hRkz20HXoZWhxbOH6SE= Received: by 10.142.177.7 with SMTP id z7mr2756514wfe.249.1215697401196; Thu, 10 Jul 2008 06:43:21 -0700 (PDT) Received: by 10.142.131.18 with HTTP; Thu, 10 Jul 2008 06:43:21 -0700 (PDT) Message-ID: <5160b4200807100643i2c7dbf0aw2fb681b0745a8ba2@mail.gmail.com> Date: Thu, 10 Jul 2008 09:43:21 -0400 From: "Jun Furuse" To: caml-list@yquem.inria.fr Subject: Recursive module and class MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16178_8735782.1215697401201" X-Spam: no; 0.00; furuse:01 furuse:01 recursive:01 recursive:01 ocamlc:01 abbrevs:01 sig:01 foo:01 struct:01 foo:01 sig:01 struct:01 mismatch:01 compiler:01 bug:01 X-Attachments: cset="UTF-8" cset="UTF-8" ------=_Part_16178_8735782.1215697401201 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Sorry if the following is already a known issue. The following program trying to define a type and a class mutually recursive is rejected by ocamlc (3.11+dev12 Private_abbrevs+natdynlink (2008-02-29)): module rec M : sig type t = Foo of N.c end = struct type t = Foo of N.c end and N : sig class c : object method x : M.t end end = struct class c = object (self) method x = M.Foo (self :> c) end end The error message is puzzling: Error: Signature mismatch: Modules do not match: sig class c : object method x : M.t end end is not included in sig class c : object method x : M.t end end Type declarations do not match: type c = N.c is not included in type c = < x : M.t > These signatures are literaly same, but do not match. The above code is accepted by the compiler if I write method x = M.Foo (self :> N.c) to coerce the object to the outer class N.c instead of c. Is it a bug of typing? Or is it ok but with a puzzling error message ? -- Jun FURUSE ------=_Part_16178_8735782.1215697401201 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

Sorry if the following is already a known issue.

The following program trying to define a type and a class mutually recursive is rejected by ocamlc (3.11+dev12 Private_abbrevs+natdynlink (2008-02-29)):

       module rec M : sig
         type t = Foo of N.c
       end = struct
         type t = Foo of N.c
       end and N : sig
         class c : object method x : M.t end
       end = struct
         class c = object (self)
           method x = M.Foo (self :> c)
         end
       end

The error message is puzzling:

       Error: Signature mismatch:
              Modules do not match:
                sig class c : object method x : M.t end end
              is not included in
                sig class c : object method x : M.t end end
              Type declarations do not match:
                type c = N.c
              is not included in
                type c = < x : M.t >

These signatures are literaly same, but do not match.

The above code is accepted by the compiler if I write

           method x = M.Foo (self :> N.c)

to coerce the object to the outer class N.c instead of c.

Is it a bug of typing? Or is it ok but with a puzzling error message ?

--
Jun FURUSE

------=_Part_16178_8735782.1215697401201--