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
Private exceptions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-01-30 (14:32)
From: Alessandro Baretta <a.baretta@b...>
Subject: Private exceptions
I have a come across the following situation: I have a relatively complex 
algorithm where exception management SHOULD occur only at the outermost function 
call. I have managed to create a rather nasty bug by inadvertently recursing 
through a function which captures exceptions coming from the inner recursive and 
does not propagate them upwards.

In this situation, I'd like to be able to declare an exception "private" to a 
module, such that that exception can only be matched within the scope of the 
exception declaration. I am currently sidestepping the problem by using an 
exception which is not exported by the defining module, and consequently cannot 
be matched explicitly, but it can be matched by a try <expr> with _ -> <whatever>.

Am I the only one with this kind of need?