And what will we do about package?

Lutger lutger.blijdestijn at gmail.com
Sat Nov 21 05:14:32 PST 2009


Don wrote:

> To quote bugzilla 143: 'package' does not work at all
> 
> But even if worked as advertised, it'd still be broken.
> 
> Although it's a really useful concept that works great in Java, the
> existing 'package' doesn't fit with D's directory-based module system.
> As I see it, the problem is that, given:
> 
> module first.second.third.fourth;
> 
> which package is this module part of?
> Is it 'third', 'second.third', or 'first.second.third'?
> 
...

Assuming you meant first, first.second and first.second.third, I'd say the 
most sensible choice is first.second.third (I actually assumed it works this 
way already). 

Why? Currently the most coarse level of granularity (excluding package) that 
has any meaning in D is the module level. If you want 'friend' access one 
step beyond that it only makes sense to choose the modules that map to the 
same directory. I'd like to think that is more than enough exposure for 
anyone.

Anything beyond that seems way too promiscuous to me, like a poor substitute 
for C++'s friend.



More information about the Digitalmars-d mailing list