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=AWL autolearn=disabled version=3.1.3 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 75985BBAF for ; Wed, 20 Aug 2008 00:54:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIDAOjrqkjAXQIniGdsb2JhbACSEwEBAQ8gpDiBWw X-IronPort-AV: E=Sophos;i="4.32,237,1217800800"; d="scan'208";a="16112948" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Aug 2008 00:54:36 +0200 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m7JMsYdh025205 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 20 Aug 2008 00:54:35 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At0BAATsqkiCcUBThWdsb2JhbACSEwEBAQoFAgYHEaQ1gVs X-IronPort-AV: E=Sophos;i="4.32,237,1217800800"; d="scan'208";a="14110962" Received: from sigma957.cis.mcmaster.ca ([130.113.64.83]) by mail2-smtp-roc.national.inria.fr with ESMTP; 20 Aug 2008 00:54:34 +0200 Received: from Gorash7.UTS.McMaster.CA (Gorash7.UTS.mcmaster.ca [130.113.196.61]) by sigma957.cis.mcmaster.ca (8.13.7/8.13.7) with ESMTP id m7JMsRd4027729 for ; Tue, 19 Aug 2008 18:54:32 -0400 (EDT) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by Gorash7.UTS.McMaster.CA (8.13.7/8.13.7) with ESMTP id m7JMrwKw013393 for ; Tue, 19 Aug 2008 18:54:08 -0400 Received: from [130.113.68.27] (account carette@univmail.cis.mcmaster.ca [130.113.68.27] verified) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.3.12) with ESMTPA id 221535815 for caml-list@inria.fr; Tue, 19 Aug 2008 18:53:58 -0400 Message-ID: <48AB4F06.4070208@mcmaster.ca> Date: Tue, 19 Aug 2008 18:53:58 -0400 From: Jacques Carette Organization: McMaster University User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: OCaml Subject: Not a variant?? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version-Mac: 5.4.2.338381, Antispam-Engine: 2.6.0.325393, Antispam-Data: 2008.8.19.224309 X-PerlMx-Spam: Gauge=IIIIIII, Probability=7%, Report='HTML_NO_HTTP 0.1, BODY_SIZE_1000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_600_699 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-Miltered: at concorde with ID 48AB4F2A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; o'caml's:01 bug:01 compile:01 constraint:01 constraint:01 variant:02 variant:02 mcmaster:02 confusing:02 output:02 jacques:03 jacques:03 let:03 let:03 types:05 The function f1 below works fine -- so type d is seen to be a variant type. However, f2 does not compile because type c is *not* a variant type. However, if one looks at O'Caml's output for type c, it visually looks like a variant, while that of d does not. This is highly confusing. This looks like a bug to me -- both c and d should be recognized as variant types. Jacques type a = [`A ] type b = [`B ] type 'a c = 'a constraint 'a = [< a | b] ;; type 'a d = 'a constraint 'a = b ;; let f1 = function | #d -> true | _ -> false let f2 = function | #c -> true | _ -> false ;;