* Report a missing match
@ 1999-09-09 16:12 Don Syme
1999-09-09 22:36 ` Jean-Yves Moyen
1999-09-10 7:53 ` Luc Maranget
0 siblings, 2 replies; 3+ messages in thread
From: Don Syme @ 1999-09-09 16:12 UTC (permalink / raw)
To: caml-list
Hi,
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...
Thanks,
Don
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Report a missing match
1999-09-09 16:12 Report a missing match Don Syme
@ 1999-09-09 22:36 ` Jean-Yves Moyen
1999-09-10 7:53 ` Luc Maranget
1 sibling, 0 replies; 3+ messages in thread
From: Jean-Yves Moyen @ 1999-09-09 22:36 UTC (permalink / raw)
To: Don Syme; +Cc: caml-list
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Report a missing match
1999-09-09 16:12 Report a missing match Don Syme
1999-09-09 22:36 ` Jean-Yves Moyen
@ 1999-09-10 7:53 ` Luc Maranget
1 sibling, 0 replies; 3+ messages in thread
From: Luc Maranget @ 1999-09-10 7:53 UTC (permalink / raw)
To: Don Syme; +Cc: caml-list
>
>
> Hi,
>
> 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...
>
> Thanks,
> Don
>
Hi,
Conceptually, this is not that difficult to do, since the compiler look for
non-exhautive matches by enumerating possible non-matching values.
In practice, I have to see a little and have no time for that now...
I put this on a personnal TODO list.
--Luc Maranget
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-09-10 14:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-09 16:12 Report a missing match Don Syme
1999-09-09 22:36 ` Jean-Yves Moyen
1999-09-10 7:53 ` Luc Maranget
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox