From: Jean-Yves Moyen <jymoyen@ens-lyon.fr>
To: Don Syme <dsyme@microsoft.com>
Cc: caml-list@inria.fr
Subject: Re: Report a missing match
Date: Fri, 10 Sep 1999 00:36:36 +0200 (MET DST) [thread overview]
Message-ID: <Pine.GSO.4.10.9909100025460.8933-100000@vanuatu> (raw)
In-Reply-To: <39ADCF833E74D111A2D700805F1951EF1801418B@RED-MSG-06>
On Thu, 9 Sep 1999, Don Syme wrote:
> It would be very helpful for me if the Caml compiler could report at least
> one missing match case when it says a match is non-exhaustive. Is this
> feasible to implement fairly painlessly? When working with very large
> datatypes, e.g. 100 constructors, it's very hard to know which case has been
> missed...
I think this can lead to a problem when using gards ('when' cases) in the
pattern matching.
typically,
let f=
function
n when n >= 0 -> true
| n when n < 0 -> false;;
is said to have a non exhaustive matching but the pattern matching is
actually exhaustive.
This is because it is sometimes really tricky to look into when-clauses in
order to check if there are exhaustive or not.
This is a bit more explained in the FAQ:
http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#gardes_partielles
In your case, if your not using gards, I guess a little script may be able
to find which cases are not in the pattern matching.
(Maybe this can even be done using camlp4, I don't know)
-------------------------------------------------------------
Quand on est jeune, on croit que le monde est peuple de vieux cons.
En vieillissant, on s'appercoit qu'il est peuple de jeunes imbeciles.
Jym.
next prev parent reply other threads:[~1999-09-10 14:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-09 16:12 Don Syme
1999-09-09 22:36 ` Jean-Yves Moyen [this message]
1999-09-10 7:53 ` 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.GSO.4.10.9909100025460.8933-100000@vanuatu \
--to=jymoyen@ens-lyon.fr \
--cc=caml-list@inria.fr \
--cc=dsyme@microsoft.com \
/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