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 AAA09921; Mon, 30 Apr 2001 00:24:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA10013 for ; Mon, 30 Apr 2001 00:24:37 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f3TMOZP09118 for ; Mon, 30 Apr 2001 00:24:35 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id PAA05289; Sun, 29 Apr 2001 15:24:20 -0700 (PDT) Date: Sun, 29 Apr 2001 15:24:20 -0700 (PDT) From: Brian Rogoff To: Anton Moscal cc: John Max Skaller , caml-list@inria.fr Subject: Re: [Caml-list] two unrelated questions In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 27 Apr 2001, Anton Moscal wrote: > 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 think the real beauty of this local module feature is that it allows things like a local open, which may make open more palatable to open-phobes. For instance if you want to get a date but don't want to "pollute" the namespace with an open'ed Unix module you can write let get_date () = let module M = struct open Unix let current_time = localtime (time()) let current_date = { year = current_time.tm_year ; month = current_time.tm_mon + 1 ; day = current_time.tm_mday ; hour = current_time.tm_hour ; minute = current_time.tm_min ; second = current_time.tm_sec } end in M.current_date though I take it that these kinds of tricks weren't the original goal of the feature. Still, the syntax is light so these are very painless workarounds even without the P4 prettification. -- Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr