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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Anton Moscal <msk@p...>
Subject: Re: [Caml-list] two unrelated questions
On Thu, 26 Apr 2001, John Max Skaller wrote:

> Unfortunately:
> 
> 	let f x = 
> 		exception Break 
> 		try ... raise Break ...
> 		with Break -> ()
> 	;;
> 
> is in error, because exception declarations must be at the top
> level. This prevents desired localisation: this feature is not
> as good as a labelled break for this purpose.

For this problem workaround exists:

let f x = 
   let module M = struct
        exception Break
        let v = try ... raise Break ... with Break ->...
       end
   in M.v

I made syntax extension for camlp4 and now can write something like this:

let f x = let exception Break in ...

Regards,
Anton
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr