Make imports private by default

Derek Parnell derek at psych.ward
Thu Apr 13 04:04:07 PDT 2006


On Thu, 13 Apr 2006 20:42:14 +1000, Frank Benoit <benoit__ at __tionex.de>  
wrote:

> There was a posting of Tyro
> http://www.digitalmars.com/d/archives/digitalmars/D/11081.html
>
> Most ppl seconded that.
>
> The problem is, that D does not work if you use non-private imports all
> the time. Suddenly there are conflicts.
>
> A public import make the imported module part of this modules interface.
> This can (and should) be made public explicitely.
>

I think the reason is that all other unadorned symbols in a module are  
public so therefore why make an exception with imports.

If that is the reason, I think it is not a good one. It assumes that  
consistency is always a good thing, that new programmers to D are too  
simple-minded to remember this 'exception', that C/C++ programmers are too  
simple-minded and thus will get confused, that remembering to type  
"private { import ... }" is easier to do that remembering (if this is  
fixed) that imports are already private, that porting C programs is going  
to be the major activity of D coders in the future, ...

Yes, I do think this is a foolish, bureaucratic, simplistic decision to  
make imports public by default.

Who here is going to be seriously affected if imports are made private by  
default?

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list