From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA32149 for caml-redistribution; Fri, 10 Sep 1999 16:53:23 +0200 (MET DST) 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 AAA23942 for ; Fri, 10 Sep 1999 00:36:45 +0200 (MET DST) Received: from buffalo.ens-lyon.fr (buffalo.ens-lyon.fr [140.77.1.8]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id AAA09862 for ; Fri, 10 Sep 1999 00:36:44 +0200 (MET DST) Received: from vanuatu (vanuatu [140.77.191.66]) by buffalo.ens-lyon.fr (8.9.1a/8.9.1) with ESMTP id AAA12823; Fri, 10 Sep 1999 00:36:41 +0200 (MET DST) Date: Fri, 10 Sep 1999 00:36:36 +0200 (MET DST) From: Jean-Yves Moyen X-Sender: jymoyen@vanuatu Reply-To: jymoyen@ens-lyon.fr To: Don Syme cc: caml-list@inria.fr Subject: Re: Report a missing match In-Reply-To: <39ADCF833E74D111A2D700805F1951EF1801418B@RED-MSG-06> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis On Thu, 9 Sep 1999, Don Syme wrote: > It would be very helpful for me if the Caml compiler could report at least > one missing match case when it says a match is non-exhaustive. Is this > feasible to implement fairly painlessly? When working with very large > datatypes, e.g. 100 constructors, it's very hard to know which case has been > missed... I think this can lead to a problem when using gards ('when' cases) in the pattern matching. typically, let f= function n when n >= 0 -> true | n when n < 0 -> false;; is said to have a non exhaustive matching but the pattern matching is actually exhaustive. This is because it is sometimes really tricky to look into when-clauses in order to check if there are exhaustive or not. This is a bit more explained in the FAQ: http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#gardes_partielles In your case, if your not using gards, I guess a little script may be able to find which cases are not in the pattern matching. (Maybe this can even be done using camlp4, I don't know) ------------------------------------------------------------- Quand on est jeune, on croit que le monde est peuple de vieux cons. En vieillissant, on s'appercoit qu'il est peuple de jeunes imbeciles. Jym.