Re: Local opening of modules

From: John Prevost (j.prevost@cs.cmu.edu)
Date: Tue Nov 10 1998 - 22:22:51 MET


Date: Tue, 10 Nov 1998 16:22:51 -0500 (EST)
From: John Prevost <j.prevost@cs.cmu.edu>
To: Anton Moscal <msk@post.tepkom.ru>
Subject: Re: Local opening of modules
In-Reply-To: <Pine.LNX.4.03.9811101745250.27072-100000@post.tepkom.ru>

On Tue, 10 Nov 1998, Anton Moscal wrote:

> With CamlP4 preprocessor (tool for syntax extension of Ocaml) I got
> this effect by the following grammar extension:
  {...}

Interesting. I hadn't realized that you could define modules inside let
statements like this:

let f x =
  let module M = struct
                   open Foo;;
                   let v = x + x
                 end
  in M.v

(which is exactly what you're doing...)

Actually, the non-sugared form I've written above is pretty satisfactory
all by itself, although not as clean looking as the sugared-up camlp4
stuff.

Thanks!

John.



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:16 MET