Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] Private exceptions
On Mon, Jan 30, 2006 at 03:31:56PM +0100, Alessandro Baretta wrote:
> [...]
> 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>.

But the ability to match any exception (and re-raise it, without
knowing anything more about it) is essential for implementing
constructs like "unwind-protect", "with-open-file", suspend/force,
etc.

-- 
Eric Cooper             e c c @ c m u . e d u