October 20, 2004
I can only agree to this.

My personal experience from Python, where imports are public:

* you get the namespace clogged up extremely fast: Library coders just do
 from somewhere import *
for their own convenience, so anyone using the library has their namespaces
filled with stuff they don't need

* Very often, you loose track where a symbol actually came from, because symbols can be imported from just about any module and you hardly ever stop to think where the symbol was actually defined.

Just my personal experience. It is nice to go for consistency (like: "everything is public by default") but it is much more important to think about the consequences for the programmer, and in this case, it really is a question of protecting the application programmer against the laziness library programmer.

Ciao,
Nobbi



Tyro wrote:

> I don't know about you guys but IMHO imports should be made private by default. On the grand scheme of things this is quite minuscule, however, I think it important to point out that a vast majority of conflicts are caused by the mere fact that imports are done publicly.
> 
> Most often when I import a  library module, I only want it to be made available only in the file into which I imported it. If I need it to be available to users of my code, I should then be required to state so explicitly.
> 
> Just my opinion.
> Andrew Edwards

1 2
Next ›   Last »