From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 5B296BB9C for ; Fri, 25 Nov 2005 23:03:47 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAPM3kDJ017910 for ; Fri, 25 Nov 2005 23:03:46 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA19718 for ; Fri, 25 Nov 2005 23:03:46 +0100 (MET) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAPM3jjV017907; Fri, 25 Nov 2005 23:03:45 +0100 Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id 61CE7D17DCC; Fri, 25 Nov 2005 17:03:43 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Fri, 25 Nov 2005 17:03:43 -0500 X-Sasl-enc: R4uUyGsAwwVr+YMyLK5CdO5FZw9OvWwaYcLSupzPPigS 1132956219 Received: from [172.16.13.154] (burnham.ljcrf.edu [192.231.106.2]) by frontend2.messagingengine.com (Postfix) with ESMTP id 6324B571482; Fri, 25 Nov 2005 17:03:36 -0500 (EST) Date: Fri, 25 Nov 2005 15:01:26 -0800 (PST) From: Martin Jambon X-X-Sender: martin@droopy To: Luc Maranget Cc: Martin Jambon , Christophe Raffalli , sejourne_kevin , caml-list Subject: Re: [Caml-list] Request for complete pattern matching In-Reply-To: <20051124092917.GB9830@yquem.inria.fr> Message-ID: References: <43839F1A.2080909@univ-savoie.fr> <43842069.3070700@yahoo.fr> <43848103.9060504@univ-savoie.fr> <20051123183134.GB6446@yquem.inria.fr> <20051124092917.GB9830@yquem.inria.fr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 43878A42.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43878A41.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 maranget:01 catch-all:01 syntax:01 3.08.3:01 camlp:01 parsing:01 3.08.3:01 hing:98 wrote:01 luc:01 exception:01 exception:01 typing:01 matched:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Thu, 24 Nov 2005, Luc Maranget wrote: >>> Typing and warnings are yet another issue! >> >> Warnings regarding incomplete match cases can be suppressed by adding >> 'when true' guards and superfluous catch-all cases. > > I mean that you will probably loose significant warnings, > with your idea you avoid spurious warnings. Of course, but it's not worse than the equivalent if-then-else style that you would use otherwise, because in the general case there's no way of detecting missing or unused cases. Pattern-matchings which don't use the syntax extension are conserved, so the warnings are still here like before in those cases. See this session: $ micmatch Objective Caml version 3.08.3 Camlp4 Parsing version 3.08.3 # match Some "thing" with Some "abc" -> () | None -> ();; Warning: this pattern-matching is not exhaustive. Here is an example of a value that is not matched: Some "" Exception: Match_failure ("", 1, 0). # match Some "thing" with Some / "t"* (_* as s) / -> s | None -> "none";; - : string = "hing" # match Some "thing" with Some / "the" _* as s / -> s | None -> "none";; Exception: Match_failure ("", 5, -56). Martin -- Martin Jambon, PhD http://martin.jambon.free.fr Store and share your bioinformatics tips at http://wikiomics.org