From: Martin Jambon <martin_jambon@emailuser.net>
To: Luc Maranget <luc.maranget@inria.fr>
Cc: Martin Jambon <martin_jambon@emailuser.net>,
Christophe Raffalli <christophe.raffalli@univ-savoie.fr>,
sejourne_kevin <sejourne_kevin@yahoo.fr>,
caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Request for complete pattern matching
Date: Fri, 25 Nov 2005 15:01:26 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.63.0511251410260.5553@droopy> (raw)
In-Reply-To: <20051124092917.GB9830@yquem.inria.fr>
On Thu, 24 Nov 2005, Luc Maranget wrote:
>>> Typing and warnings are yet another issue!
>>
>> Warnings regarding incomplete match cases can be suppressed by adding
>> 'when true' guards and superfluous catch-all cases.
>
> I mean that you will probably loose significant warnings,
> with your idea you avoid spurious warnings.
Of course, but it's not worse than the equivalent if-then-else style that
you would use otherwise, because in the general case there's no way of
detecting missing or unused cases.
Pattern-matchings which don't use the syntax extension are conserved, so
the warnings are still here like before in those cases.
See this session:
$ micmatch
Objective Caml version 3.08.3
Camlp4 Parsing version 3.08.3
# match Some "thing" with
Some "abc" -> ()
| None -> ();;
Warning: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
Some ""
Exception: Match_failure ("", 1, 0).
# match Some "thing" with
Some / "t"* (_* as s) / -> s
| None -> "none";;
- : string = "hing"
# match Some "thing" with
Some / "the" _* as s / -> s
| None -> "none";;
Exception: Match_failure ("", 5, -56).
Martin
--
Martin Jambon, PhD
http://martin.jambon.free.fr
Store and share your bioinformatics tips at http://wikiomics.org
next prev parent reply other threads:[~2005-11-25 22:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-22 22:43 Christophe Raffalli
2005-11-23 5:54 ` [Caml-list] " Luc Maranget
2005-11-23 14:37 ` Christophe Raffalli
2005-11-23 10:06 ` Michal Moskal
2005-11-23 15:26 ` Christophe Raffalli
[not found] ` <43842069.3070700@yahoo.fr>
2005-11-23 14:47 ` Christophe Raffalli
2005-11-23 18:31 ` Luc Maranget
2005-11-23 20:56 ` Martin Jambon
2005-11-23 21:30 ` skaller
2005-11-23 22:25 ` Martin Jambon
2005-11-24 9:29 ` Luc Maranget
2005-11-25 23:01 ` Martin Jambon [this message]
2005-11-23 20:56 ` Christophe Raffalli
2005-11-24 9:41 ` Luc Maranget
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=Pine.LNX.4.63.0511251410260.5553@droopy \
--to=martin_jambon@emailuser.net \
--cc=caml-list@inria.fr \
--cc=christophe.raffalli@univ-savoie.fr \
--cc=luc.maranget@inria.fr \
--cc=sejourne_kevin@yahoo.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