Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: Irrelevant variables in patterns
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <cr@d...>
Subject: Irrelevant variables in patterns

>>>La solution serait plutot de fournir un warning lorsque l'on capture toutes
>>>les exception, car cela est un bug dans 99% des cas (on ne veut pas attraper
>>>Catch_break ou Out_of_memory en general).

>But that doesn't work if I have 10 different exceptions in my program
>- I am unwilling to write 10-way branches, as are most programmers.

>Exceptions in ML are a programming mechanism.  They are not used
>anymore for exceptional conditions.  We need a new mechanism for that.


Ok, but as long as "Out_of_memory" and "catch_break" are exceptions, if you
don't write the ten cases, this is likely to be a bug !!

Moreover, if you need to catch an exception, it means you want to do something
with it, which is in general specific to this exception. So you have to write
all the branches in most cases (the syntax "A | B | C ->" is then very

Furthermore, I just asked for a warning ! this would catch the attention of
the programmer on a likely bug. but if he knowns what he is doing, he is free
to do so.