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.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id DF6DFBC0B for ; Tue, 28 Nov 2006 20:54:17 +0100 (CET) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kASJsH4E021228 for ; Tue, 28 Nov 2006 20:54:17 +0100 Received: from db2.internal (db2.internal [10.202.2.12]) by out1.messagingengine.com (Postfix) with ESMTP id 18D2E47C95; Tue, 28 Nov 2006 14:54:18 -0500 (EST) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by db2.internal (MEProxy); Tue, 28 Nov 2006 14:54:18 -0500 X-Sasl-enc: G5NxgHCfC/ocM81whXxtlTKNRHZ4Ck8x7qKwyEnoMm/v 1164743657 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by mail.messagingengine.com (Postfix) with ESMTP id 3C0AC311F; Tue, 28 Nov 2006 14:54:17 -0500 (EST) Date: Tue, 28 Nov 2006 11:53:21 -0800 (PST) From: Martin Jambon X-X-Sender: martin@localhost To: taras Cc: caml-list@inria.fr Subject: Re: [Caml-list] Pattern matching fallthrough with guards In-Reply-To: <456C8774.4040009@shaw.ca> Message-ID: References: <456C8774.4040009@shaw.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-j-chkmail-Score: MSGID : 456C93E9.000 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 456C93E9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hypothetical:01 syntax:01 bug:01 bug:01 1977:98 wrote:01 caml-list:01 jambon:01 jambon:01 pattern:04 matching:06 tue:06 function:08 function:08 i'm:09 On Tue, 28 Nov 2006, taras wrote: > Hi, > I noticed that one can coalesce multiple patterns like > > function Some _ > | None -> 0 > > However when I add guards to this hypothetical example, I get a syntax error > > function Some _ when 1 = 2 > | None -> 0 > > I'm wondering if this inconsistency is considered to be a bug or not? It's not a bug. The "when" guard must come just before the arrow. But the vertical bar may be more powerful than what you expect. You can do this: function Some (0|1) | None -> ... | ... Martin -- Martin Jambon, PhD http://martin.jambon.free.fr