Need review: explicit package protection

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 8 14:54:52 PDT 2014


08-Jun-2014 19:37, Dicebot пишет:
> Finally got to cleanup and submit this PR:
> https://github.com/D-Programming-Language/dmd/pull/3651
>
> While proposed change is very small (and backwards-compatible)
> and not worth separate DIP, it is still a language change and
> needs community approval.
>
> Copy of description:
>
> ========================================
>
> Currently there is no way to use package protection attribute
> with deeply nested package hierarchy, forcing to either use flat
> one or public protection. This is one of blocking issues for
> further usage of package.d in Phobos and one of reasons why
> namespace hacks are so popular.
>
> For example, if helpers in std.internal will be marked as
> package, only std.internal will be able to access those, but not
> rest of std. This PR fixes it by allowing package(<pkgname>)
> syntax to explicitly define owning package.
>
[snip]
Even during my first experiments with turning parts of Phobos into 
packages I've been bitten by this. So basically +1 from me.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list