Time to destroy Walter: breaking modules into packages
Jonathan M Davis
jmdavisProg at gmx.com
Tue Jun 18 22:35:00 PDT 2013
On Wednesday, June 19, 2013 06:49:49 TommiT wrote:
> On Thursday, 6 June 2013 at 06:09:41 UTC, Max Samukha wrote:
> > 'package' should be fixed so that 'package' declarations are
> > accessible within nested packages.
>
> I don't think the 'package' access specifier should give
> privileges to *all* nested packages. Rather, I think we just need
> to invent a new word, and then specifying what 'package' access
> specifier does becomes easy. My suggestion for this new word is
> "module-pack"...
>
> Module-pack:
> "A folder which has a file called package.d inside it. Can be
> imported as if it was a module. etc."
>
> ...then, the definition of 'package' access modifier would be:
>
> "The label package can be specified at class level, outside all
> classes (module-level), or inside a struct. In all contexts,
> package introduces protection that allows access to the symbol to
> all modules and module-packs which are either within the same
> directory as the current module or within the same directory as
> the module-pack which holds the current module within.
> Non-module-pack subdirectories and the parent directory of the
> current module’s directory have no special privileges."
>
> Basically we'd pretend that module-packs are like modules.
I _really_ don't like the idea of having the presence of package.d affect the
package modifier, and I don't think that anything which controls how many
levels deep the package modifier gives the package access to is worth the extra
complication. If it's worth letting nested packages have access to their
parent packages package-level stuff, then let's just do that for everything.
Trying to make it configurable really doesn't buy us much and adds yet more
complication to an already complicated language.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list