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 OAA29408; Tue, 11 Sep 2001 14:08:40 +0200 (MET DST) 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 OAA29924 for ; Tue, 11 Sep 2001 14:08:39 +0200 (MET DST) Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8BC8cL27799 for ; Tue, 11 Sep 2001 14:08:38 +0200 (MET DST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.11.6/2001082200) with ESMTP id f8BC8aP09574; Tue, 11 Sep 2001 14:08:36 +0200 (CEST) Received: from mail.cs.uni-sb.de (IDENT:i+JA7OIyIQnStEGtbtw0A8aTQUtmu7yy@mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.11.6/2001081600) with ESMTP id f8BC8Zd17887; Tue, 11 Sep 2001 14:08:35 +0200 (CEST) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.11.6/2001082200) with ESMTP id f8BC8Xo07368; Tue, 11 Sep 2001 14:08:33 +0200 (CEST) X-Authentication-Warning: email: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from ps.uni-sb.de (zoidberg.ps.uni-sb.de [134.96.186.121]) by ps.uni-sb.de (8.11.2/8.11.0) with ESMTP id f8BC8Xt00447; Tue, 11 Sep 2001 14:08:33 +0200 Message-ID: <3B9DFEC0.2D7BCAEA@ps.uni-sb.de> Date: Tue, 11 Sep 2001 14:08:32 +0200 From: Andreas Rossberg Organization: =?iso-8859-1?Q?Universit=E4t?= des Saarlandes X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3-12 i686) X-Accept-Language: de, en MIME-Version: 1.0 To: caml-list@inria.fr CC: Sven Subject: Re: [Caml-list] Style question References: <20010909132144.X7348-100000@shell5.ba.best.com> <3B9DE076.568458F9@ps.uni-sb.de> <20010911125524.B29665@dpt-info.u-strasbg.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Sven wrote: > > > local open M in > > ... > > end > > > > Of course, in OCaml this is solved by having open vs. include. > > Also, would not : > > let module = struct ... end in > > be another solution for it, maybe in conjunction with the open syntax ? Not sure, since I don't understand your code snippet, or how it is related to local or open. Could you clarify a bit? Anyway, there are of course several ways to rewrite SML's local. If it involves only core declarations and the body consists of only one function you might transform it into a let, although I think that is usually not a good idea. On structure level the most faithful translation to OCaml is: module Local = struct (* Prefix *) module Body = struct (* Body *) end end include Local.Body But this is quite unreadable and introduces the auxiliary module name Local (which would not be necessary if OCaml supported let as module expressions). In general relying on signature constraints is by far the best solution and works for all sane uses of local. - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de "Computer games don't affect kids; I mean if Pac Man affected us as kids, we would all be running around in darkened rooms, munching magic pills, and listening to repetitive electronic music." - Kristian Wilson, Nintendo Inc. ------------------- 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