caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* "Warning U: this match case is unused." -- Yes, I know
@ 2008-02-27 21:32 David Teller
  2008-02-27 21:48 ` [Caml-list] " Till Varoquaux
  2008-02-27 22:09 ` Edgar Friendly
  0 siblings, 2 replies; 6+ messages in thread
From: David Teller @ 2008-02-27 21:32 UTC (permalink / raw)
  To: OCaml

   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. 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-27 22:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-27 21:32 "Warning U: this match case is unused." -- Yes, I know David Teller
2008-02-27 21:48 ` [Caml-list] " Till Varoquaux
2008-02-27 21:56   ` David Teller
2008-02-27 22:09 ` Edgar Friendly
2008-02-27 22:21   ` David Teller
2008-02-27 22:30     ` Edgar Friendly

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).