Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: David Teller <David.Teller@u...>
Subject: Re: [Caml-list] "Warning U: this match case is unused." -- Yes, I know
On Wed, 2008-02-27 at 16:09 -0600, Edgar Friendly wrote:
> > 1. I can wrap the user's pattern-matching inside a try...with, catch any
> > Match_failure and deal with it. 
> This seems hackish.

Indeed. I'm not planning to carry on that threat :)

> It may seem that you've taken care of all cases, but keep in mind that
> the compiler looks at a match case containing a 'when' clause and
> assumes that clause can cause the match to fail, independent of all
> other terms.

Let me rephrase.

In my extension, the user can decide of *any* pattern. The main
difference with usual OCaml-style pattern-matching is that the
equivalent of Match_failure is not a fatal error. Think Erlang-style
mailbox-checking or ML-style exception catching: if there's no
interesting message waiting or if we're installing an exception handler
for another exception than what has been raised, well, it's probably not
an error. 

So I need to be able to specify what happens in case of match failure.
Doing that is a one-liner, I can just add 
  | _ -> foobar
after my last match case. Now, I just want to get rid of Warning U.

Cheers,
 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.