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 XAA08622; Sun, 29 Apr 2001 23:05:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA08732 for caml-list@pauillac.inria.fr; Sun, 29 Apr 2001 23:05:26 +0200 (MET DST) 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 TAA18839 for ; Fri, 27 Apr 2001 19:50:23 +0200 (MET DST) Received: from localhost.localdomain (ppp217.dyn147.pacific.net.au [210.23.147.217]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f3RHoJL09370 for ; Fri, 27 Apr 2001 19:50:20 +0200 (MET DST) Received: from ozemail.com.au (IDENT:root@localhost [127.0.0.1]) by localhost.localdomain (8.9.3/8.8.7) with ESMTP id DAA02423; Sat, 28 Apr 2001 03:49:13 +1000 Message-ID: <3AE9B118.C9B4E2A7@ozemail.com.au> Date: Sat, 28 Apr 2001 03:49:12 +1000 From: John Max Skaller X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Brian Rogoff CC: caml-list@inria.fr Subject: Re: [Caml-list] two unrelated questions References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Brian Rogoff wrote: > 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. > 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 = > let module Local = struct > exception Break > let f () = > try (print_endline ("hello " ^ x); raise Break) with Break -> () > end in > Local.f () Actually, this works too: let f x = let module Local = struct exception Break end in try raise Local.Break with Local.Break -> () Furthermore, this doesn't work: let f x = type integer = int let i:integer = 1 in ... but this does: let f x = let module Local = struct type integer = int end in let i: Local.integer = 1 in ... which makes me wonder why it is necessary to wrap exception declarations and type aliases in modules: is there a semantic reason I'm missing, or is it just a parsing issue? -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr