Time to destroy Walter: breaking modules into packages

Jonathan M Davis jmdavisProg at gmx.com
Wed Jun 5 19:35:59 PDT 2013


On Thursday, June 06, 2013 04:10:26 Marco Leise wrote:
> Am Wed, 05 Jun 2013 18:31:22 -0400
> 
> schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
> > https://github.com/D-Programming-Language/dmd/pull/2139
> > 
> > Andrei
> 
> To those who don't want to see a < 1000 lines module: Please
> consider that as soon as we'd merge multiple compression
> algorithms into one file for the sake of making the module
> "large enough", it will turn back on us when we decide to
> implement any larger number of those:
> http://en.wikipedia.org/wiki/Category:Lossless_compression_algorithms
> 
> I see one down side though: Some algorithms are alterations of
> others and could reuse code. For the sake of speaking module
> names I'd still split the compression algorithms into multiple
> modules and probably let one import the other.

If each of the compression algorithms is in its own module which is in the 
same package as other compression modules, then they can use package access to 
share stuff that would be specific to them but not belong in Phobos in general. 
But I believe that package level access only works on the same level, so you 
couldn't have separate modules for compressing and decompressing as was being 
suggested. It would need to be more like

std.compress.zlib;
std.compress.lzw;

At that point, it would be trivial to have a common module of some kind with 
shared functionality which has package access level.

- Jonathan M Davis


More information about the Digitalmars-d mailing list