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=none 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 951CABBAF for ; Tue, 20 Jan 2009 18:30:37 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtgEAHCYdUmCcUBTgWdsb2JhbACUBwEBCwcECgcRt3SFcw X-IronPort-AV: E=Sophos;i="4.37,295,1231110000"; d="scan'208";a="34031886" Received: from sigma957.cis.mcmaster.ca ([130.113.64.83]) by mail4-smtp-sop.national.inria.fr with ESMTP; 20 Jan 2009 18:30:36 +0100 Received: from Dura7.UTS.McMaster.CA (dura7.UTS.mcmaster.ca [130.113.196.62]) by sigma957.cis.mcmaster.ca (8.13.7/8.13.7) with ESMTP id n0KHU9ni007334; Tue, 20 Jan 2009 12:30:31 -0500 (EST) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by Dura7.UTS.McMaster.CA (8.13.7/8.13.7) with ESMTP id n0KHTm9L001029; Tue, 20 Jan 2009 12:29:48 -0500 Received: from [129.97.84.95] (account carette@univmail.cis.mcmaster.ca HELO [192.168.1.109]) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.3.12) with ESMTPSA id 239320606; Tue, 20 Jan 2009 12:29:48 -0500 Message-ID: <49760A0C.5080204@mcmaster.ca> Date: Tue, 20 Jan 2009 12:29:48 -0500 From: Jacques Carette User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Dario Teixeira Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Private types in 3.11, again References: <865755.99476.qm@web111508.mail.gq1.yahoo.com> In-Reply-To: <865755.99476.qm@web111508.mail.gq1.yahoo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version-Mac: 5.4.2.338381, Antispam-Engine: 2.6.0.325393, Antispam-Data: 2009.1.20.171339 X-PerlMx-Spam: Gauge=IIIIIII, Probability=7%, Report='BODY_SIZE_1600_1699 0, BODY_SIZE_5000_LESS 0, __BOUNCE_CHALLENGE_SUBJ 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' X-Spam: no; 0.00; hmmm:01 bug:01 ocaml:01 annotations:01 bug:01 mismatch:01 sig:01 val:01 sig:01 val:01 node:01 node:01 compiler:01 compiler:01 seq:01 Hmmm, a variant of your code may be exhibiting a bug in ocaml 3.11.0. In your signature, change the +'a t signature to type +'a t = private [< elem_t ] and remove all annotations from the definition of sprint2. Then, as defined, one gets the error message File "bug2.ml", line 26, characters 0-223: Error: Signature mismatch: Modules do not match: sig val sprint2 : ([< `Bold of 'a list | `Text of string ] as 'a) -> string end is not included in sig val sprint2 : 'a Node.t -> string end Values do not match: val sprint2 : ([< `Bold of 'a list | `Text of string ] as 'a) -> string is not included in val sprint2 : 'a Node.t -> string which is not very informative, especially since expanding 'a Node.t gives exactly what the compiler reports as the first argument of sprint2. To coax the compiler to be more helpful, on places the definition of sprint2 outside a module (but still in the same file as Node), and instead the result is: File "bug2.ml", line 30, characters 26-29: Error: This expression has type Node.elem_t list but is here used with type 'a Node.t list Type Node.elem_t = [ `Bold of Node.elem_t list | `Text of string ] is not compatible with type 'a Node.t = [< `Bold of Node.elem_t list | `Text of string ] Types for tag `Text are incompatible [That point to the seq in List.map sprintf2 seq]. Here is where the potential bug is: how is string incompatible with string? [If this is a bug, I'll add it to the database] Jacques