Make imports private by default

kris foo at bar.com
Fri Apr 14 12:13:06 PDT 2006


Derek Parnell wrote:
> On Fri, 14 Apr 2006 12:06:08 +1000, Sean Kelly <sean at f4.ca> wrote:
> 
>> Derek Parnell wrote:
>>
>>> On Fri, 14 Apr 2006 03:37:14 +1000, kris <foo at bar.com> wrote:
>>>
>>>>
>>>> In order to make D easy to learn and use, surely consistency in 
>>>> usage  should be a priority? D kinda has that right now in this 
>>>> particular  area, in that everything is public by default. It would 
>>>> also be fine,  IMO, if everything were private by default :)
>>>
>>>  How many cars have rubber steering wheels? After all, the other 
>>> wheels  are made of rubber and we do worship consistency?
>>
>>
>> Oh come on, that's a false analogy.
> 
> 
> Sorry. "the heat of the moment" and all that stuff ... don't know what  
> came over me.
> 
> I'm just not convinced yet that "consistency" is the highest design  
> priority. To me, "usability" is more important even if that means that 
> two  things are not 'consistent'.
> 

I'm a big fan of the "Principal Of Least Surprise", where 'consistency' 
is often a prime factor. You're right, of course, that the latter does 
not always produce the former, even though it typically does. Further, I 
suspect that most "veteran" engineers would agree that "all private by 
default" produces the least surprises over time. Symbolic encapsulation, 
as a /default/, would probably be a good thing. How hard is it to type 
the word "public" when necessary?

Either way, let's not lose sight of the rather obvious question-mark: 
would private imports resolve the symbol/namespace collisions? In my 
humble experience with D, it does not.





More information about the Digitalmars-d mailing list