Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
"Warning U: this match case is unused." -- Yes, I know
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-27 (21:48)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] "Warning U: this match case is unused." -- Yes, I know
There is a function in camlp4 that checks for this:
Check that you have a recent ocaml. It used to be bugged (it was fixed
in mid september).


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
>   Angry researcher: French Universities need reforms, but the LRU act brings liquidations.
>  _______________________________________________
>  Caml-list mailing list. Subscription management:
>  Archives:
>  Beginner's list:
>  Bug reports: