Phango

Matti Niemenmaa see_signature at for.real.address
Tue Nov 20 08:02:44 PST 2007


Oskar Linde wrote:
> I believe shallow hierarchies generally are better than deep, and also
> that there should be a functional rather than logical separation between
> packages.
> 
> So, instead of:
> 
> tango.util.collection.iterator.InterleavingIterator
> 
> couldn't there just be:
> 
> tango.collection.iterators
> 
> or perhaps even:
> 
> tango.collection

One problem with shoving all iterators into one module is the way the protection
specifiers work in D. As you probably know, private and co are module-level.
This means that InterleavingIterator and TropicalJungleIterator, while
completely distinct, can access each other's privates! The fact that they are in
different modules thus accentuates their independence of each other.

If protection specifiers worked as they do in C++ (and, as a matter of fact, in
just about every other language I know of that implements such a feature), then
a "tango.collection.iterators" package would make more sense. As it is, putting
two classes into the same module suggests that they are tightly coupled and, at
least to me, that they do access each other's private members.

Plus, especially a general-purpose module such as "tango.collection" would grow
to thousands of lines in length. This would make it a pain to code in, but there
are also issues for the user. For instance, the automatically generated DDoc
would also be exceedingly long and would have to manually be separated into
coherent parts.

I do agree that the "tango.util.collection" package should be just
"tango.collection", though. :-)

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list