Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] queasiness about Exit
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francois Pottier <francois.pottier@i...>
Subject: Re: [Caml-list] queasiness about Exit

Hi,

> But I'm having trouble convincing myself that this won't get me into
> trouble with obscure bugs later as things get complicated and
> "predicate" or "map_for_effect_on_complex_data_structure" might themselves
> be implemented in terms of "try .. raise Exit .. with Exit -> .."
> constructs.

Indeed, if you use the same exception `Exit' throughout all of your code,
then you might get into this kind of trouble.

I'd suggest using a different exception every time you need one, to avoid the
risk of accidental capture. A module can declare an arbitrary number of
exceptions for internal use; you can even generate new exceptions dynamically
(using local modules, introduced by `let module') if needed (although that's
pretty rare).

-- 
François Pottier
Francois.Pottier@inria.fr
http://pauillac.inria.fr/~fpottier/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr