From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA17138; Fri, 27 Apr 2001 17:09:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA17089 for ; Fri, 27 Apr 2001 17:09:40 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f3RF9dL06779 for ; Fri, 27 Apr 2001 17:09:39 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id IAA20069; Fri, 27 Apr 2001 08:09:35 -0700 (PDT) Date: Fri, 27 Apr 2001 08:09:35 -0700 (PDT) From: Brian Rogoff To: John Max Skaller cc: caml-list@inria.fr Subject: Re: [Caml-list] two unrelated questions In-Reply-To: <3AE80F56.DFDC823F@ozemail.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 26 Apr 2001, John Max Skaller wrote: > "Judica=EBl Courant" wrote: >=20 > > > exception Break > > > try > > > List.iter (fun .. -> ... raise Break) l > > > with Break -> () >=20 > Unfortunately: >=20 > =09let f x =3D=20 > =09=09exception Break=20 > =09=09try ... raise Break ... > =09=09with Break -> () > =09;; >=20 > 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. Well, this kind of thing is what local does in SML and a few people have asked for it before. You can use the local module feature to do the same thing. let f x =3D=20 let module Local =3D struct=20 exception Break let f () =3D=20 try (print_endline ("hello " ^ x); raise Break) with Break -> () end in Local.f () This is a very handy feature of OCaml.=20 -- Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr