Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Functorizing large collections of modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yaron M. Minsky <yminsky@c...>
Subject: Re: [Caml-list] Functorizing large collections of modules
The solution suggested below clearly works, but it's just as clearly a
bit of a hack.  My feeling is that this is a bit of a fundamental
weakness of ocaml and the module/functor system.  OCaml is generally too
module-centric, in that structuring tools are available only up to the
level of modules, and there is no good structure beyond that.

Another example of this weakness is the lack of support for namespaces. 
Again, you can hack namespaces into existence by tossing lots of modules
in the same file, but that's clearly a bad solution.

Do any of the other MLs fare better in this department?  And do people
have good solutions for the namespace problem or the large-scale functor
problem I outlined earlier?

y

On Mon, 2002-03-18 at 07:52, Sami Mäkelä wrote:
> "Yaron M. Minsky" wrote:
> > > > Conceptually what I want is a single structure like this:
> > > >
> > > > module Library(ZZp:ZZpSig) =
> > > > struct
> > > >
> > > >   module Foo =
> > > >   struct ... end
> > > >
> > > >   module Bar =
> > > >   struct ... end
> > > >
> > > >   ...
> > > >
> > > > end
> 
> what i have used is:
> 
> foo.ml:
> 
> module Library (ZZp:ZZpSig) =
> struct
>   module Foo = struct ... end
> end
> 
> bar.ml:
> 
> module Library (ZZp:ZZpSig) =
> struct
>   include Foo.Library (ZZp)
>   module Bar = struct ... end
> end
> 
> quux.ml:
> 
> module Library (ZZp:ZZpSig) =
> struct
>   include Bar.Library (ZZp)
>   module Quux = struct ... end
> end
> 
> etc.
> 
> there are still few problems, but perhaps this is good enough
> 
> 
> > > >
> > > > That way, all the interior modules (Foo, Bar) get to reference the same
> > > > ZZp, without having to functorize the individual modules.  So, what I'd
> > > > like is to be able to do this without sticking the modules Foo and Bar
> > > > into the same single large unmanageable file.
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 
-- 
|--------/            Yaron M. Minsky              \--------|
|--------\ http://www.cs.cornell.edu/home/yminsky/ /--------|

Open PGP --- KeyID B1FFD916 (new key as of Dec 4th)
Fingerprint: 5BF6 83E1 0CE3 1043 95D8 F8D5 9F12 B3A9 B1FF D916

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners