Package level access broken?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Apr 22 17:13:10 PDT 2012
On Monday, April 23, 2012 01:59:15 Era Scarecrow wrote:
> On Sunday, 22 April 2012 at 23:32:40 UTC, Jonathan M Davis wrote:
> > 1. Package access is _very_ broken:
> > http://d.puremagic.com/issues/show_bug.cgi?id=143
>
> Fun... So it's not just me... Guess for the 1-2 places I 'll
> need package level access instead I gotta either do public or get
> some getters (Was just hoping to ignore that).
For the most part, I believe that the problem is that you can use package
functions when you _shouldn't_ be able to rather than not being able to use
them when you should, but I'd have to read through the bug report again.
Certainly, for the little that I've used package, it's at least worked in that
other stuff in the package is able to access it.
> > 2. I'm not sure that your code is even using package properly.
>
> No, they may not be in a package specifically; I but with them
> being directory/hierarchy they should be in the package group.
It's debatable. And from what's happening with your code, it certainly looks
like the compiler does not consider such modules to be in the same package.
Personally, I would argue that if you intend to use package, it should
actually be with stuff in their own package anyway, not base level modules.
Otherwise, it's not much different from using public. And with that, whether
the compiler treats t1 and t2 as being in the same package or not becomes
irrelevant.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list