Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Style question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Rogoff <bpr@b...>
Subject: Re: [Caml-list] Style question
On Tue, 11 Sep 2001, Sven wrote:
> On Tue, Sep 11, 2001 at 02:08:32PM +0200, Andreas Rossberg wrote:
> > 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?

let module = struct open M <do stuff with opened> ... let f = ... end
in f ...

This pretty much gives you local open, with very little verbosity. I don't
even think the sugar is needed.

> Well, consider :
>
> let module M = struct let f x = x * x end in M.f 5 ;;
>
> Sure, you still have to access f trough M., but you could imagine something
> with the open/include directive. Not sure if it is possible already to do a
> local open, but i think it was already discussed in the past. Consider :

The solution is just to do the open in the local module, and everything in
the scope of that module can use opened identifiers.

-- Brian


-------------------
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