caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Till Varoquaux" <till.varoquaux@gmail.com>
To: "David Teller" <David.Teller@univ-orleans.fr>
Cc: OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] "Warning U: this match case is unused." -- Yes, I know
Date: Wed, 27 Feb 2008 21:48:56 +0000	[thread overview]
Message-ID: <9d3ec8300802271348u62892bbdva98f880c9cb8ddc9@mail.gmail.com> (raw)
In-Reply-To: <1204147958.7005.17.camel@Blefuscu>

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
<David.Teller@univ-orleans.fr> 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/


  reply	other threads:[~2008-02-27 21:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 21:32 David Teller
2008-02-27 21:48 ` Till Varoquaux [this message]
2008-02-27 21:56   ` [Caml-list] " David Teller
2008-02-27 22:09 ` Edgar Friendly
2008-02-27 22:21   ` David Teller
2008-02-27 22:30     ` Edgar Friendly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d3ec8300802271348u62892bbdva98f880c9cb8ddc9@mail.gmail.com \
    --to=till.varoquaux@gmail.com \
    --cc=David.Teller@univ-orleans.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).