Version française
Home     About     Download     Resources     Contact us    
Browse thread
Wanted: your feedback on the hierarchy of OCaml Batteries Included
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stefano Zacchiroli <zack@u...>
Subject: Re: [Caml-list] open Module (not?) considered harmful
On Thu, Nov 20, 2008 at 11:29:44AM -0000, David Allsopp wrote:
> > Why? You and others failed me to convince of this. Or, better, I'm
> > sure there are problems with that, but they just show deficiencies
> > inherited from other parts of the language.
>  
> Consider
> 
> open Array;;
> open List;;

You are stretching quite a lot what is being proposed. You are
deliberately taking two similar modules (two data structure modules,
which also happen to be really similar ADTs), and opening them
together. Doing that is asking for trouble, the only way to avoid that
is forbidding entirely open, which nobody else has proposed either.

What is being proposed wrt the Batteries hierarchy is to open module
paths, which in most (maybe even all) of the cases just contain other
modules. The potential clashes are related to module pairs, and wont
exhibit the problem you shown, because the clashing modules will not
be union-ed together. One will win over the other.

> > >   The most straightforward solution to this problem to me looks like
> > >   providing a syntax equivalent like "from Module import foo, bar"
> > >   which selectively imports only some identifiers from a given module.
> 
> Which, for values only, is of course a trivial camlp4
> extension... and could be generalised to include type declarations

Yes, which is one of the reason while I was proposing it. Still, you
did not to comment on whether such an extension (which we already
have, thanks to Nicolas) would be a satisfying solution for the open
issue, which is basically my position.

Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime