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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL 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 5B8B5BBCA for ; Wed, 27 Feb 2008 22:48:59 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABJqxUfAXQInh2dsb2JhbACQaAEBAQgKKZUWh34 X-IronPort-AV: E=Sophos;i="4.25,415,1199660400"; d="scan'208";a="23131129" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 27 Feb 2008 22:48:59 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1RLmwLf029770 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 27 Feb 2008 22:48:58 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAANZpxUfRVaKxkmdsb2JhbACQaAEBAQEHBAQJChaVHId+ X-IronPort-AV: E=Sophos;i="4.25,415,1199660400"; d="scan'208";a="8683643" Received: from el-out-1112.google.com ([209.85.162.177]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Feb 2008 22:48:58 +0100 Received: by el-out-1112.google.com with SMTP id m34so2847998ele.9 for ; Wed, 27 Feb 2008 13:48:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=pJZt08XwNZt//42WrxfcNscRbfr9XrJkx6fUEiyFiE0=; b=B2lFwy2Fjy9VJH3iyi0a0pCik1tkCWIR7Kat6WbGLfQ6Fy9y4mLjv9LrLRLx2bwqepIjO2qF1CLPc7np7LkLKb7B31PW8TUYU1ymdyVho9GCc29Y0zhRbSvRYXJXBWcLyi8jLfQgLa4/75aeZiq56jDCnNWdGPPFNXE9PSpVkkc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SqL6Mzq8bWN8CQV7ci97uOK9ZLqCY77J+ud8qByPhriMj/GRAj9qn2LAgF/tH5du2JvJ4ciSQMJh/eJz5cCx/F7C3vw+Ej463TrPzvP7vsVaa6WBRScm/X4LIVSupRwJJdmoDRsPqFoUnNAhsZBMYul/0iC1UdZjpYnhGTqi5U8= Received: by 10.142.231.7 with SMTP id d7mr5834908wfh.30.1204148936276; Wed, 27 Feb 2008 13:48:56 -0800 (PST) Received: by 10.142.98.15 with HTTP; Wed, 27 Feb 2008 13:48:56 -0800 (PST) Message-ID: <9d3ec8300802271348u62892bbdva98f880c9cb8ddc9@mail.gmail.com> Date: Wed, 27 Feb 2008 21:48:56 +0000 From: "Till Varoquaux" To: "David Teller" Subject: Re: [Caml-list] "Warning U: this match case is unused." -- Yes, I know Cc: OCaml In-Reply-To: <1204147958.7005.17.camel@Blefuscu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1204147958.7005.17.camel@Blefuscu> X-Miltered: at concorde with ID 47C5DACA.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 ocaml:01 cheers:01 univ-orleans:01 camlp:01 bindings:01 catch-all:01 semantics:01 rewriting:01 compiler:01 univ-orleans:01 lifo:01 beginner's:01 ocaml:01 bug:01 There is a function in camlp4 that checks for this: Ast.is_irrefut_patt Check that you have a recent ocaml. It used to be bugged (it was fixed in mid september). Cheers On Wed, Feb 27, 2008 at 9:32 PM, David Teller wrote: > Dear list, > > I'm currently working on a little Camlp4 extension which has to often > generate pattern-matching clauses depending on user code -- and deal > with match failures accordingly. > > Now, I guess > > 1. I can wrap the user's pattern-matching inside a try...with, catch any > Match_failure and deal with it. However, ensuring that the Match_failure > is the right one and that I'm not catching some other error in the code, > all this while performing bindings satisfactorily will require numerous > contorsions. > > 2. I can add a catch-all clause " _ -> deal_with_error ". While the > semantics of this rewriting are exactly what I need, the compiler tends > to print "Warning U: this match case is unused" whenever the user has > already taken care of all cases. I would need to find a way to > deactivate the warning for this specific clause. As I haven't found any > way of doing that directly, I've been thinking about adding a "when > True" to the second-to-last clause if that clause doesn't already have a > "when", but I'd be glad to hear about better solutions. > > Thanks in advance, > David > > -- > David Teller > Security of Distributed Systems > http://www.univ-orleans.fr/lifo/Members/David.Teller > Angry researcher: French Universities need reforms, but the LRU act brings liquidations. > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- http://till-varoquaux.blogspot.com/