Make imports private by default
Sean Kelly
sean at f4.ca
Thu Apr 13 10:23:08 PDT 2006
Hasan Aljudy wrote:
> Frank Benoit 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 never understood why people use private imports .. just what the hell
> is the point?
> Please give real, concrete examples, not just theories/talk.
> "Clogging up the namespace" doesn't say anything meaningful to me.
It's similar to why things can be made private at class scope. Private
imports are akin to implementation details--a user of the module
shouldn't know or care about them. Public symbols exposed by a module
are essentially that module's interface, in much the same was as public
symbols of a class are the classes interface. If it isn't something
specifically intended for use then it shouldn't be public.
Sean
More information about the Digitalmars-d
mailing list