Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2008-11-20 (10:49)
From: Stefano Zacchiroli <zack@u...>
Subject: open Module (not?) considered harmful
On Thu, Nov 20, 2008 at 10:33:03AM +0000, Richard Jones wrote:
> Encouraging developers to open modules is also usually a bad idea,
> except in very limited circumstances (hello Printf).

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.

Problem 1) once you open you loose the information where an identifier
  comes from. True, but it is a tool deficiency, not an intrinsic

  AFAIU Ocamlwizard addresses that [1].

Problem 2) "open Module" is too broad, hence it "splice in" the
  current scope all identifiers of Module. I do agree that the
  solution of locally defined modules is not a satisfactory solution
  for that problem, for the reason mentioned (cumbersome syntax, and
  non-uniform choice for the local module names).

  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.



Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
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