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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sven Luther <luther@d...>
Subject: Re: [Caml-list] camlimages vs. labltk
On Sun, Mar 30, 2003 at 12:06:27PM +0200, Damien Doligez wrote:
> On Friday, March 28, 2003, at 04:00 PM, Sven Luther wrote:
> 
> >Does this not sound as a ugly hack ?
> 
> Not to me...

Ok, ...

> >Would it not be easier to have something akin to -pack, but without its
> >technical problems, and have each library pack its module into a
> >namespace propper to this library ?
> 
> How do you make sure that two different libraries never use the same
> namespace ?  And if I need to use two versions of the same library
> in my program, how do you make sure that two versions of the same
> library never use the same namespace ?

Because you use something similar to the -pack option, each module
inside a library would be qualified by the library name, so the only
reason there could be a namespace conflict would be if two library used
the same name (like if ocamltk and labltk both used Tk. or both mlgtk
and lablgtk used Gtk.).

If there is such a conflict, either the people doing the conflicting
libraries discuss among themselves to solve the problem, either by one
of them renaming their lib or both of them merging , or some higher
authority (the ocaml team, a ocaml standardization comitee, a consensus
reached on the ocaml mailing list) takes some decision on on which way
the name should go. But still, i believe the name clash will pretty much
be extremely rare, since they would occur only with the names of the
library, not with the modules inside the libraries.

Now, i understand that the -pack option is not technically ready for
such a solution, if you consider that you have to link all modules of
the library inside one huge .cmo, which has to be included whole anytime
you use it. But i think that the above is the right solution to the
naming problem, and if i remember well, some members of the ocaml team
also seemed to be of that opinion last time this was discussed.

> >If all library did this by default, at library build time, then there
> >would be no need to rename the imports, since those imports would
> >already have the modified (that is Library.Module) names ?
> 
> You can't avoid renaming of imports unless you have a centralized
> allocation of namespaces, and _that_ sounds like an ugly hack to me.

I still don't understand what would have been renamed. Let's say a
module A inside a library foo imports a module B from library bar.

right now, we have the following :

  A imports B

this causes problem if you want to link with another library
which also has a module named B, or if you wish to name your own module
B.

now, if all modules of the library would be submodules of the library,
then we would have :

  Foo.A imports Bar.B

And now, another library zzz could have a module called B, which would
be accesed as Zzz.B, and there would be no need to rename the imports.
And even the personal module could either be plain B, or Personal.B or
something.

Sure, this displace the problam to library names instead of module
names, but still, there are much less libraries around than there are
modules.

But then, maybe i am just being stupid and completely misunderstand the
problem or something such, please enlighten me if this is the case.

Friendly,

Sven Luther

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